diff options
author | Jonas Smedegaard <dr@jones.dk> | 2008-05-31 09:23:03 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2008-05-31 09:23:03 +0200 |
commit | 0f9b433157c58eda2296e06d6183475688c43468 (patch) | |
tree | fc4d3919d6a4fa589420044874cf4f27a088ba94 /perl/Locale | |
parent | 5922fe24289c4ae998960607face97f5a10af1e5 (diff) |
Sync with po4a 0.33.3.
Diffstat (limited to 'perl/Locale')
-rw-r--r-- | perl/Locale/Po4a/Text.pm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/perl/Locale/Po4a/Text.pm b/perl/Locale/Po4a/Text.pm index ae62667..0b0ca70 100644 --- a/perl/Locale/Po4a/Text.pm +++ b/perl/Locale/Po4a/Text.pm @@ -83,6 +83,15 @@ released versions, which only contain non translatable informations. my $debianchangelog = 0; +=item B<fortunes> + +Handle the fortunes format, which separate fortunes with a line which +consists in '%' or '%%', and use '%%' as the beginning of a comment. + +=cut + +my $fortunes = 0; + =item B<markdown> Handle some special markup in Markdown-formatted texts. @@ -105,6 +114,10 @@ sub initialize { $debianchangelog=1; } + if (defined $options{'fortunes'}) { + $fortunes=1; + } + if (defined $options{'markdown'}) { $markdown=1; } @@ -136,6 +149,15 @@ sub parse { $paragraph=""; $self->pushline("$line\n"); $expect_header=1; + } elsif ($fortunes and + $line =~ m/^%%?\s*$/) { + # Found end of fortune + do_paragraph($self,$paragraph,$wrapped_mode); + $self->pushline("\n") unless ( $wrapped_mode == 0 + or $paragraph eq ""); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline("$line\n"); } elsif ($line =~ /^\s*$/) { # Break paragraphs on lines containing only spaces do_paragraph($self,$paragraph,$wrapped_mode); @@ -170,6 +192,8 @@ sub parse { # paragraph $wrapped_mode = 0; } + $line =~ s/%%(.*)$//; +# TODO: comments $paragraph .= $line."\n"; } # paragraphs starting by a bullet, or numbered @@ -254,7 +278,7 @@ Tested successfully on simple text files and NEWS.Debian files. =head1 COPYRIGHT AND LICENSE - Copyright 2005,2007 by Nicolas FRANÇOIS <nicolas.francois@centraliens.net>. + Copyright 2005-2008 by Nicolas FRANÇOIS <nicolas.francois@centraliens.net>. This program is free software; you may redistribute it and/or modify it under the terms of GPL (see the COPYING file). |