Revision 03ea9764
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/Locale.pm | ||
---|---|---|
105 | 105 |
} |
106 | 106 |
|
107 | 107 |
sub _handle_markup { |
108 |
my $self = shift; |
|
109 |
my $str = shift; |
|
108 |
my $self = shift;
|
|
109 |
my $str = shift;
|
|
110 | 110 |
|
111 |
if ($str eq "\\n") { |
|
112 |
return "\n"; |
|
113 |
} elsif ($str eq "\\r") { |
|
114 |
return "\r"; |
|
115 |
} |
|
111 |
my $escaped = 0; |
|
112 |
my $new_str = ''; |
|
113 |
|
|
114 |
for (my $i = 0; $i < length $str; $i++) { |
|
115 |
my $char = substr $str, $i, 1; |
|
116 |
|
|
117 |
if ($escaped) { |
|
118 |
if ($char eq 'n') { |
|
119 |
$new_str .= "\n"; |
|
116 | 120 |
|
117 |
$str =~ s/\\x(..)/chr(hex($1))/eg;
|
|
118 |
$str =~ s/\\(.)/$1/g;
|
|
121 |
} elsif ($char eq 'r') {
|
|
122 |
$new_str .= "\r";
|
|
119 | 123 |
|
120 |
return $str; |
|
124 |
} elsif ($char eq 's') { |
|
125 |
$new_str .= ' '; |
|
126 |
|
|
127 |
} elsif ($char eq 'x') { |
|
128 |
$new_str .= chr(hex(substr($str, $i + 1, 2))); |
|
129 |
$i += 2; |
|
130 |
|
|
131 |
} else { |
|
132 |
$new_str .= $char; |
|
133 |
} |
|
134 |
|
|
135 |
$escaped = 0; |
|
136 |
|
|
137 |
} elsif ($char eq '\\') { |
|
138 |
$escaped = 1; |
|
139 |
|
|
140 |
} else { |
|
141 |
$new_str .= $char; |
|
142 |
} |
|
143 |
} |
|
144 |
|
|
145 |
return $new_str; |
|
121 | 146 |
} |
122 | 147 |
|
123 | 148 |
sub _read_special_chars_file { |
... | ... | |
160 | 185 |
$scmap->{order} = [ map { $self->_handle_markup($_) } split m/\s+/, $order ]; |
161 | 186 |
$self->{special_chars_map}->{"${format}-reverse"}->{order} = [ grep { $_ } map { $scmap->{$_} } reverse @{ $scmap->{order} } ]; |
162 | 187 |
} |
188 |
|
|
189 |
$main::lxdebug->dump(0, "scm", $self->{special_chars_map}); |
|
163 | 190 |
} |
164 | 191 |
|
165 | 192 |
sub text { |
locale/de/special_chars | ||
---|---|---|
33 | 33 |
|
34 | 34 |
[Template/LaTeX] |
35 | 35 |
order=\\ <pagebreak> & \n \r " $ % _ # ^ { } < > ? ? \xe1 ? ? |
36 |
\\=\\textbackslash
|
|
36 |
\\=\\textbackslash\s
|
|
37 | 37 |
<pagebreak>= |
38 | 38 |
"='' |
39 | 39 |
&=\\& |
... | ... | |
45 | 45 |
}=\\} |
46 | 46 |
<=$<$ |
47 | 47 |
>=$>$ |
48 |
?=\\pounds
|
|
49 |
\n=\\newline
|
|
48 |
?=\\pounds\s
|
|
49 |
\n=\\newline\s
|
|
50 | 50 |
\r= |
51 | 51 |
?=$\\pm$ |
52 | 52 |
\xe1=$\\bullet$ |
53 |
^=\\^\\
|
|
53 |
^=\\^\\\s
|
|
54 | 54 |
?=$^2$ |
55 | 55 |
?=$^3$ |
56 | 56 |
|
Auch abrufbar als: Unified diff
Parser für besondere Zeichen in special_chars umgeschrieben.