diff options
author | Jonas Smedegaard <dr@jones.dk> | 2008-05-31 09:23:03 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2013-10-13 00:47:50 +0200 |
commit | 39576e67199a706aaac8804d096beee8083b4ddc (patch) | |
tree | 9d5623f2cb73f1e7e1d9a7b3968b01378dd9541c | |
parent | 355d79ded047eea0a8c75fa760f1339523aacd87 (diff) |
Sync with po4a 0.33.3.
-rw-r--r-- | Locale/Po4a/Text.pm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Locale/Po4a/Text.pm b/Locale/Po4a/Text.pm index ae62667..0b0ca70 100644 --- a/Locale/Po4a/Text.pm +++ b/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). |