1 |
#!/usr/bin/perl |
#!/usr/bin/perl |
2 |
use strict; |
use strict; |
3 |
use Encode; |
use Encode; |
4 |
|
my $opt = {}; |
5 |
sub c{ |
sub c{ |
6 |
$_ = shift; |
$_ = shift; |
7 |
|
s/\\preprocess{([^{}=\s]+)(?:\s*=\s*([^{}=\s]*))?}/$opt->{$1}=defined$2?$2:1;''/ge; |
8 |
s/\x{3001}/, /g; |
s/\x{3001}/, /g; |
9 |
s/\x{3002}/. /g; |
s/\x{3002}/. /g; |
10 |
|
s/\$/\\\$/g if $opt->{'Perl-mode'}; |
11 |
s{\\sourcecode\s*(?:\[([^\[\]]*)\]\s*)?{([^{}]+)}}{ |
s{\\sourcecode\s*(?:\[([^\[\]]*)\]\s*)?{([^{}]+)}}{ |
12 |
my %opt = map {$_->[1] = 1 unless defined $_->[1]; @$_} |
my %opt = map {$_->[1] = 1 unless defined $_->[1]; @$_} |
13 |
map {[split /\s*=\s*/, $_, 2]} split /\s*,\s*/, $1; |
map {[split /\s*=\s*/, $_, 2]} split /\s*,\s*/, $1; |