[Po4a-commits] po4a/lib/Locale/Po4a TeX.pm,1.6,1.7
Nicolas FRAN??OIS
po4a-devel@lists.alioth.debian.org
Fri, 04 Feb 2005 20:21:02 +0000
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv18016/lib/Locale/Po4a
Modified Files:
TeX.pm
Log Message:
Add handling of the "separated" command category (to specify which commands
can be separated from a paragraph when they are at the end or beginning of
this paragraph).
Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TeX.pm 8 Jan 2005 10:44:28 -0000 1.6
+++ TeX.pm 4 Feb 2005 20:21:00 -0000 1.7
@@ -70,7 +70,7 @@
@EXPORT = qw(%commands %environments
$RE_ESCAPE $ESCAPE
$no_wrap_environments $separated_commands
- %command_categories
+ %command_categories %separated
&untranslated &translate_joined &push_environment);
use Locale::Po4a::TransTractor;
@@ -94,6 +94,8 @@
# Space separated list of commands that can be handle separately from
# when they appear at the beginning or end of a paragraph
our $separated_commands = "index label";
+# hash with these commands
+our %separated = ();
# Hash of categories and their associated commands.
# Commands are space separated.
@@ -271,7 +273,8 @@
print STDERR "get_leading_command($buffer)="
if ($debug{'extract_commands'});
- if ($buffer =~ m/^\s*$RE_ESCAPE([[:alpha:]]+)(\*?)(.*)$/s) {
+ if ($buffer =~ m/^\s*$RE_ESCAPE([[:alpha:]]+)(\*?)(.*)$/s
+ && $separated{$1}) {
# The buffer begin by a comand (possibly preceded by some
# whitespaces).
$command = $1;
@@ -418,7 +421,8 @@
}
# There should now be a command, maybe followed by an asterisk.
- if ($buffer =~ m/^(.*)$RE_ESCAPE([[:alpha:]]+)(\*?)\s*$/s) {
+ if ($buffer =~ m/^(.*)$RE_ESCAPE([[:alpha:]]+)(\*?)\s*$/s
+ && $separated{$2}) {
$buffer = $1;
$command = $2;
$variant = $3;
@@ -612,7 +616,6 @@
$self->{TT}{ascii_input} = 0;
# Save the reference for future error message
$self->{TT}{non_ascii_ref} ||= $ref;
- print "cucu'$ref'$textline'\n";
}
}
}
@@ -884,5 +887,10 @@
}
$commands{$_} = \&translate_joined;
}
+
+ # build an hash with keys in $separated_commands to ease searches.
+ foreach (split(/ /, $separated_commands)){
+ $separated{$_}=1;
+ };
}