summaryrefslogtreecommitdiff
path: root/Locale
diff options
context:
space:
mode:
Diffstat (limited to 'Locale')
-rw-r--r--Locale/Po4a/Text.pm26
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).