Revision 03ea9764
Von Moritz Bunkus vor etwa 17 Jahren hinzugefügt
SL/Locale.pm | ||
---|---|---|
}
|
||
|
||
sub _handle_markup {
|
||
my $self = shift;
|
||
my $str = shift;
|
||
my $self = shift;
|
||
my $str = shift;
|
||
|
||
if ($str eq "\\n") {
|
||
return "\n";
|
||
} elsif ($str eq "\\r") {
|
||
return "\r";
|
||
}
|
||
my $escaped = 0;
|
||
my $new_str = '';
|
||
|
||
for (my $i = 0; $i < length $str; $i++) {
|
||
my $char = substr $str, $i, 1;
|
||
|
||
if ($escaped) {
|
||
if ($char eq 'n') {
|
||
$new_str .= "\n";
|
||
|
||
$str =~ s/\\x(..)/chr(hex($1))/eg;
|
||
$str =~ s/\\(.)/$1/g;
|
||
} elsif ($char eq 'r') {
|
||
$new_str .= "\r";
|
||
|
||
return $str;
|
||
} elsif ($char eq 's') {
|
||
$new_str .= ' ';
|
||
|
||
} elsif ($char eq 'x') {
|
||
$new_str .= chr(hex(substr($str, $i + 1, 2)));
|
||
$i += 2;
|
||
|
||
} else {
|
||
$new_str .= $char;
|
||
}
|
||
|
||
$escaped = 0;
|
||
|
||
} elsif ($char eq '\\') {
|
||
$escaped = 1;
|
||
|
||
} else {
|
||
$new_str .= $char;
|
||
}
|
||
}
|
||
|
||
return $new_str;
|
||
}
|
||
|
||
sub _read_special_chars_file {
|
||
... | ... | |
$scmap->{order} = [ map { $self->_handle_markup($_) } split m/\s+/, $order ];
|
||
$self->{special_chars_map}->{"${format}-reverse"}->{order} = [ grep { $_ } map { $scmap->{$_} } reverse @{ $scmap->{order} } ];
|
||
}
|
||
|
||
$main::lxdebug->dump(0, "scm", $self->{special_chars_map});
|
||
}
|
||
|
||
sub text {
|
locale/de/special_chars | ||
---|---|---|
|
||
[Template/LaTeX]
|
||
order=\\ <pagebreak> & \n \r " $ % _ # ^ { } < > ? ? \xe1 ? ?
|
||
\\=\\textbackslash
|
||
\\=\\textbackslash\s
|
||
<pagebreak>=
|
||
"=''
|
||
&=\\&
|
||
... | ... | |
}=\\}
|
||
<=$<$
|
||
>=$>$
|
||
?=\\pounds
|
||
\n=\\newline
|
||
?=\\pounds\s
|
||
\n=\\newline\s
|
||
\r=
|
||
?=$\\pm$
|
||
\xe1=$\\bullet$
|
||
^=\\^\\
|
||
^=\\^\\\s
|
||
?=$^2$
|
||
?=$^3$
|
||
|
Auch abrufbar als: Unified diff
Parser für besondere Zeichen in special_chars umgeschrieben.