From 0f9b433157c58eda2296e06d6183475688c43468 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 31 May 2008 09:23:03 +0200 Subject: Sync with po4a 0.33.3. --- perl/Locale/Po4a/Text.pm | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'perl/Locale/Po4a/Text.pm') 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 + +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 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 . + Copyright 2005-2008 by Nicolas FRANÇOIS . This program is free software; you may redistribute it and/or modify it under the terms of GPL (see the COPYING file). -- cgit v1.2.3