[Po4a-commits] "po4a/lib/Locale/Po4a Text.pm,1.7,1.8"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Mon Oct 9 21:01:06 UTC 2006
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv7934/lib/Locale/Po4a
Modified Files:
Text.pm
Log Message:
Support consecutive bulleted paragraphs, without empty line to separate them.
Index: Text.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Text.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Text.pm 9 Oct 2006 19:32:08 -0000 1.7
+++ Text.pm 9 Oct 2006 21:01:04 -0000 1.8
@@ -135,6 +135,7 @@
# Other bullets supported:
# - blah o blah + blah
# 1. blah 1) blah (1) blah
+TEST_BULLET:
if ($paragraph =~ m/^(\s*)((?:[-*o+]|([0-9]+[.\)])|\([0-9]+\))\s+)([^\n]*\n)(.*)$/s) {
my $para = $5;
my $bullet = $2;
@@ -145,16 +146,29 @@
$text .= $1;
}
# TODO: detect if a line starts with the same bullet
- if ($para eq '' and $text !~ m/\S[ \t][ \t][ \t]+\S/s) {
+ if ($text !~ m/\S[ \t][ \t][ \t]+\S/s) {
+ my $bullet_regex = $indent1.$bullet;
+ $bullet_regex =~ s/\*/\\\*/;
+ $bullet_regex =~ s/\+/\\\+/;
+ $bullet_regex =~ s/\./\\\./;
+ $bullet_regex =~ s/[0-9]+/\\d\+/;
+ if ($para eq '' or $para =~ m/^$bullet_regex\S/s) {
my $trans = $self->translate($text,
$self->{ref},
- "Bullet: '$bullet'",
+ "Bullet: '$indent1$bullet'",
"wrap" => 1,
"wrapcol" => - (length $indent2));
$trans =~ s/^/$indent1$bullet/s;
$trans =~ s/\n(.)/\n$indent2$1/sg;
$self->pushline( $trans."\n" );
- return;
+ if ($para eq '') {
+ return;
+ } else {
+ # Another bullet
+ $paragraph = $para;
+ goto TEST_BULLET;
+ }
+ }
}
}
}
More information about the Po4a-commits
mailing list