summaryrefslogtreecommitdiff
path: root/perl/Locale/Po4a/Text.pm
blob: e64a4a1de0b2f811ab4d3d33b22eb628c59333f6 (plain)
  1. #!/usr/bin/perl -w
  2. # Po4a::Text.pm
  3. # extract and translate translatable strings from a text documents
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc.,
  18. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. #
  20. ########################################################################
  21. =head1 NAME
  22. Locale::Po4a::Text - Convert text documents from/to PO files
  23. =head1 DESCRIPTION
  24. The po4a (po for anything) project goal is to ease translations (and more
  25. interestingly, the maintenance of translations) using gettext tools on
  26. areas where they were not expected like documentation.
  27. Locale::Po4a::Text is a module to help the translation of text documents into
  28. other [human] languages.
  29. Paragraphs are splitted on empty lines (or lines containing only spaces or
  30. tabulations).
  31. If a paragraph contains a line starting by a space (or tabulation), this
  32. paragraph won't be rewrapped.
  33. =cut
  34. package Locale::Po4a::Text;
  35. use 5.006;
  36. use strict;
  37. use warnings;
  38. require Exporter;
  39. use vars qw(@ISA @EXPORT);
  40. @ISA = qw(Locale::Po4a::TransTractor);
  41. @EXPORT qw();
  42. use Locale::Po4a::TransTractor;
  43. use Locale::Po4a::Common;
  44. =head1 OPTIONS ACCEPTED BY THIS MODULE
  45. These are this module's particular options:
  46. =over
  47. =item B<nobullet>
  48. Deactivate detection of bullets.
  49. By default, when a bullet is detected, the bullet paragraph is not considered
  50. as a verbatim paragraph (with the no-wrap flag in the PO file), but the module
  51. rewrap this paragraph in the generated PO file and in the translation.
  52. =cut
  53. my $bullets 1;
  54. =item B<debianchangelog>
  55. Handle the header and footer of
  56. released versions, which only contain non translatable informations.
  57. =cut
  58. my $debianchangelog 0;
  59. =item B<fortunes>
  60. Handle the fortunes format, which separate fortunes with a line which
  61. consists in '%' or '%%', and use '%%' as the beginning of a comment.
  62. =cut
  63. my $fortunes 0;
  64. =item B<markdown>
  65. Handle some special markup in Markdown-formatted texts.
  66. =cut
  67. my $markdown 0;
  68. =item B<asciidoc>
  69. Handle documents in the asciidoc format.
  70. =cut
  71. my $asciidoc 0;
  72. =back
  73. =cut
  74. sub initialize {
  75.     my $self shift;
  76.     my %options @_;
  77.     $self->{options}{'nobullets'}='';
  78.     if (defined $options{'nobullets'}) {
  79.         $bullets 0;
  80.     }
  81.     if (defined $options{'debianchangelog'}) {
  82.         $debianchangelog=1;
  83.     }
  84.     if (defined $options{'fortunes'}) {
  85.         $fortunes=1;
  86.     }
  87.     if (defined $options{'markdown'}) {
  88.         $markdown=1;
  89.     }
  90.     $asciidoc=if (defined $options{'asciidoc'});
  91. }
  92. sub parse {
  93.     my $self shift;
  94.     my ($line,$ref);
  95.     my $paragraph="";
  96.     my $wrapped_mode 1;
  97.     my $expect_header 1;
  98.     ($line,$ref)=$self->shiftline();
  99.     my $file $ref;
  100.     $file =~ s/:[0-9]+$//;
  101.     while (defined($line)) {
  102.         $ref =~ m/^(.*):[0-9]+$/;
  103.         if ($1 ne $file) {
  104.             $file $1;
  105.             do_paragraph($self,$paragraph,$wrapped_mode);
  106.             $paragraph="";
  107.         }
  108.         chomp($line);
  109.         $self->{ref}="$ref";
  110.         if ($debianchangelog and
  111.             $expect_header and
  112.             $line =~ /^(\w[-+0-9a-z.]*)\ \(([^\(\\t]+)\# src, version
  113.                        \s+([-+0-9a-z.]+);                 # distribution
  114.                        \s*urgency\s*\=\s*(.*\S)\s*$/ix) { #
  115.             do_paragraph($self,$paragraph,$wrapped_mode);
  116.             $paragraph="";
  117.             $self->pushline("$line\n");
  118.             $expect_header=0;
  119.         elsif ($debianchangelog and
  120.                  $line =~ m/^ \-\- (.*) <(.*)> ((\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}(\s+\([^\\\(\)]\))?)$/) {
  121.             # Found trailer
  122.             do_paragraph($self,$paragraph,$wrapped_mode);
  123.             $paragraph="";
  124.             $self->pushline("$line\n");
  125.             $expect_header=1;
  126.         elsif ($fortunes and
  127.                  $line =~ m/^%%?\s*$/) {
  128.             # Found end of fortune
  129.             do_paragraph($self,$paragraph,$wrapped_mode);
  130.             $self->pushline("\n"unless (   $wrapped_mode == 0
  131.                                           or $paragraph eq "");
  132.             $paragraph="";
  133.             $wrapped_mode 1;
  134.             $self->pushline("$line\n");
  135.         elsif (    (defined $self->{verbatim})
  136.                  and ($self->{verbatim} == 2)) {
  137.             # Untranslated blocks
  138.             $self->pushline($line."\n");
  139.             if ($asciidoc and
  140.                 ($line =~ m/^(\/{4,}|~{4,})$/)) {
  141.                 undef $self->{verbatim};
  142.                 undef $self->{type};
  143.                 $wrapped_mode 1;
  144.             }
  145.         elsif ($line =~ /^\s*$/) {
  146.             # Break paragraphs on lines containing only spaces
  147.             do_paragraph($self,$paragraph,$wrapped_mode);
  148.             $paragraph="";
  149.             $wrapped_mode unless defined($self->{verbatim});
  150.             $self->pushline($line."\n");
  151.         elsif ($asciidoc and (not defined($self->{verbatim})) and
  152.                  ($line =~ m/^(\+|--)$/)) {
  153.             # List Item Continuation or List Block
  154.             do_paragraph($self,$paragraph,$wrapped_mode);
  155.             $paragraph="";
  156.             $self->pushline($line."\n");
  157.         elsif ($asciidoc and (not defined($self->{verbatim})) and
  158.                  ($line =~ m/^(={4,}|-{4,}|~{4,}|\^{4,}|\+{4,})$/and
  159.                  (defined($paragraph) )and
  160.                  ($paragraph =~ m/^[^\n]*\n$/sand
  161.                  (length($paragraph) == (length($line)+1))) {
  162.             # Found title
  163.             $wrapped_mode 0;
  164.             my $level $line;
  165.             $level =~ s/^(.).*$/$1/;
  166.             my $t $self->translate($paragraph,
  167.                                      $self->{ref},
  168.                                      "Title $level",
  169.                                      "wrap" => 0);
  170.             $self->pushline($t);
  171.             $paragraph="";
  172.             $wrapped_mode 1;
  173.             $self->pushline(($level (length($t)-1))."\n");
  174.         elsif ($asciidoc and
  175.                  ($line =~ m/^(={1,5})( +)(.*?)( +\1)?$/)) {
  176.             my $titlelevel1 $1;
  177.             my $titlespaces $2;
  178.             my $title $3;
  179.             my $titlelevel2 $4||"";
  180.             # Found one line title
  181.             do_paragraph($self,$paragraph,$wrapped_mode);
  182.             $wrapped_mode 0;
  183.             $paragraph="";
  184.             my $t $self->translate($title,
  185.                                      $self->{ref},
  186.                                      "Title $titlelevel1",
  187.                                      "wrap" => 0);
  188.             $self->pushline($titlelevel1.$titlespaces.$t.$titlelevel2."\n");
  189.             $wrapped_mode 1;
  190.         elsif ($asciidoc and
  191.                  ($line =~ m/^(\/{4,}|\+{4,}|-{4,}|\.{4,}|\*{4,}|_{4,}|={4,}|~{4,})$/)) {
  192.             # Found one delimited block
  193.             my $t $line;
  194.             $t =~ s/^(.).*$/$1/;
  195.             my $type "delimited block $t";
  196.             if (defined $self->{verbatimand ($self->{typene $type)) {
  197.                 $paragraph .= "$line\n";
  198.             else {
  199.             do_paragraph($self,$paragraph,$wrapped_mode);
  200.             if (    (defined $self->{type})
  201.                 and ($self->{typeeq $type)) {
  202.                 undef $self->{type};
  203.                 undef $self->{verbatim};
  204.                 $wrapped_mode 1;
  205.             else {
  206.                 if ($t eq "\/") {
  207.                     # CommentBlock, should not be treated
  208.                     $self->{verbatim} = 2;
  209.                 elsif ($t eq "+") {
  210.                     # PassthroughBlock
  211.                     $wrapped_mode 0;
  212.                     $self->{verbatim} = 1;
  213.                 elsif ($t eq "-") {
  214.                     # ListingBlock
  215.                     $wrapped_mode 0;
  216.                     $self->{verbatim} = 1;
  217.                 elsif ($t eq ".") {
  218.                     # LiteralBlock
  219.                     $wrapped_mode 0;
  220.                     $self->{verbatim} = 1;
  221.                 elsif ($t eq "*") {
  222.                     # SidebarBlock
  223.                     $wrapped_mode 1;
  224.                 elsif ($t eq "_") {
  225.                     # QuoteBlock
  226.                     if (    (defined $self->{type})
  227.                         and ($self->{typeeq "verse")) {
  228.                         $wrapped_mode 0;
  229.                         $self->{verbatim} = 1;
  230.                     else {
  231.                         $wrapped_mode 1;
  232.                     }
  233.                 elsif ($t eq "=") {
  234.                     # ExampleBlock
  235.                     $wrapped_mode 1;
  236.                 elsif ($t eq "~") {
  237.                     # Filter blocks, TBC: not translated
  238.                     $wrapped_mode 0;
  239.                     $self->{verbatim} = 2;
  240.                 
  241.                 $self->{type} = $type;
  242.             }
  243.             $paragraph="";
  244.             $self->pushline($line."\n");
  245.             }
  246.         elsif ($asciidoc and not defined $self->{verbatimand
  247.                  ($line =~ m/^\[\[([^\]]*)\]\]$/)) {
  248.             # Found BlockId
  249.             do_paragraph($self,$paragraph,$wrapped_mode);
  250.             $paragraph="";
  251.             $wrapped_mode 1;
  252.             $self->pushline($line."\n");
  253.             undef $self->{bullet};
  254.             undef $self->{indent};
  255.         elsif ($asciidoc and not defined $self->{verbatimand
  256.                  ($paragraph eq ""and
  257.                  ($line =~ m/^((?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):\s+)(.*)$/)) {
  258.             my $type $1;
  259.             my $text $2;
  260.             do_paragraph($self,$paragraph,$wrapped_mode);
  261.             $paragraph=$text."\n";
  262.             $wrapped_mode 1;
  263.             $self->pushline($type);
  264.             undef $self->{bullet};
  265.             undef $self->{indent};
  266.         elsif ($asciidoc and not defined $self->{verbatimand
  267.                  ($line =~ m/^\[(NOTE|TIP|IMPORTANT|WARNING|CAUTION|verse|quote)\]$/)) {
  268.             my $type $1;
  269.             do_paragraph($self,$paragraph,$wrapped_mode);
  270.             $paragraph="";
  271.             $wrapped_mode 1;
  272.             $self->pushline($line."\n");
  273.             if ($type  eq "verse") {
  274.                 $wrapped_mode 0;
  275.             }
  276.             undef $self->{bullet};
  277.             undef $self->{indent};
  278.         elsif ($asciidoc and not defined $self->{verbatimand
  279.                  ($line =~ m/^\[(verse|quote), +(.*)\]$/)) {
  280.             my $type $1;
  281.             my $arg $2;
  282.             do_paragraph($self,$paragraph,$wrapped_mode);
  283.             $paragraph="";
  284.             my $t $self->translate($arg,
  285.                                      $self->{ref},
  286.                                      "$type",
  287.                                      "wrap" => 0);
  288.             $self->pushline("[$type$t]\n");
  289.             $wrapped_mode 1;
  290.             if ($type  eq "verse") {
  291.                 $wrapped_mode 0;
  292.             }
  293.             $self->{type} = $type;
  294.             undef $self->{bullet};
  295.             undef $self->{indent};
  296.         elsif ($asciidoc and not defined $self->{verbatimand
  297.                  ($line =~ m/^\[icon="(.*)"\]$/)) {
  298.             my $arg $1;
  299.             do_paragraph($self,$paragraph,$wrapped_mode);
  300.             $paragraph="";
  301.             my $t $self->translate($arg,
  302.                                      $self->{ref},
  303.                                      "icon",
  304.                                      "wrap" => 0);
  305.             $self->pushline("[icon=\"$t\"]\n");
  306.             $wrapped_mode 1;
  307.             undef $self->{bullet};
  308.             undef $self->{indent};
  309.         elsif ($asciidoc and not defined $self->{verbatimand
  310.                  ($line =~ m/^\[icons=None, +caption="(.*)"\]$/)) {
  311.             my $arg $1;
  312.             do_paragraph($self,$paragraph,$wrapped_mode);
  313.             $paragraph="";
  314.             my $t $self->translate($arg,
  315.                                      $self->{ref},
  316.                                      "caption",
  317.                                      "wrap" => 0);
  318.             $self->pushline("[icons=None, caption=\"$t\"]\n");
  319.             $wrapped_mode 1;
  320.             undef $self->{bullet};
  321.             undef $self->{indent};
  322.         elsif ($asciidoc and not defined $self->{verbatimand
  323.                  ($line =~ m/^(\s*)([*_+`'#[:alnum:]].*)((?:::|;;|\?\?|:-)(?: *\\)?)$/)) {
  324.             my $indent $1;
  325.             my $label $2;
  326.             my $labelend $3;
  327.             # Found labeled list
  328.             do_paragraph($self,$paragraph,$wrapped_mode);
  329.             $paragraph="";
  330.             $wrapped_mode 1;
  331.             $self->{bullet} = "";
  332.             $self->{indent} = $indent;
  333.             my $t $self->translate($label,
  334.                                      $self->{ref},
  335.                                      "Labeled list",
  336.                                      "wrap" => 0);
  337.             $self->pushline("$indent$t$labelend\n");
  338.         elsif ($asciidoc and not defined $self->{verbatimand
  339.                  ($line =~ m/^(\s*)(\S.*)((?:::|;;)\s+)(.*)$/)) {
  340.             my $indent $1;
  341.             my $label $2;
  342.             my $labelend $3;
  343.             my $labeltext $4;
  344.             # Found Horizontal Labeled Lists
  345.             do_paragraph($self,$paragraph,$wrapped_mode);
  346.             $paragraph=$labeltext."\n";
  347.             $wrapped_mode 1;
  348.             $self->{bullet} = "";
  349.             $self->{indent} = $indent;
  350.             my $t $self->translate($label,
  351.                                      $self->{ref},
  352.                                      "Labeled list",
  353.                                      "wrap" => 0);
  354.             $self->pushline("$indent$t$labelend");
  355.         elsif ($asciidoc and not defined $self->{verbatimand
  356.                  ($line =~ m/^\:(\S.*?)(:\s*)(.*)$/)) {
  357.             my $attrname $1;
  358.             my $attrsep $2;
  359.             my $attrvalue $3;
  360.             # Found a Attribute entry
  361.             do_paragraph($self,$paragraph,$wrapped_mode);
  362.             $paragraph="";
  363.             $wrapped_mode 1;
  364.             undef $self->{bullet};
  365.             undef $self->{indent};
  366.             my $t $self->translate($attrvalue,
  367.                                      $self->{ref},
  368.                                      "Attribute :$attrname:",
  369.                                      "wrap" => 0);
  370.             $self->pushline(":$attrname$attrsep$t\n");
  371.         elsif ($asciidoc and not defined $self->{verbatimand
  372.                  ($line !~ m/^\.\./and ($line =~ m/^\.(\S.*)$/)) {
  373.             my $title $1;
  374.             # Found block title
  375.             do_paragraph($self,$paragraph,$wrapped_mode);
  376.             $paragraph="";
  377.             $wrapped_mode 1;
  378.             undef $self->{bullet};
  379.             undef $self->{indent};
  380.             my $t $self->translate($title,
  381.                                      $self->{ref},
  382.                                      "Block title",
  383.                                      "wrap" => 0);
  384.             $self->pushline(".$t\n");
  385.         elsif ($asciidoc and not defined $self->{verbatimand
  386.                  ($line =~ m/^(\s*)((?:[-*o+]|(?:[0-9]+[.\)])|(?:[a-z][.\)])|\([0-9]+\)|\.|\.\.)\s+)(.*)$/)) {
  387.             my $indent $1||"";
  388.             my $bullet $2;
  389.             my $text $3;
  390.             do_paragraph($self,$paragraph,$wrapped_mode);
  391.             $paragraph $text."\n";
  392.             $self->{indent} = $indent;
  393.             $self->{bullet} = $bullet;
  394.         elsif ($asciidoc and not defined $self->{verbatimand
  395.                  ($line =~ m/^((?:<?[0-9]+)?> +)(.*)$/)) {
  396.             my $bullet $1;
  397.             my $text $2;
  398.             do_paragraph($self,$paragraph,$wrapped_mode);
  399.             $paragraph $text."\n";
  400.             $self->{indent} = "";
  401.             $self->{bullet} = $bullet;
  402.         elsif ($asciidoc and not defined $self->{verbatimand
  403.                  (defined $self->{bulletand $line =~ m/^(\s+)(.*)$/)) {
  404.             my $indent $1;
  405.             my $text $2;
  406.             if (not defined $self->{indent}) {
  407.                 $paragraph .= $text."\n";
  408.                 $self->{indent} = $indent;
  409.             elsif (length($paragraphand (length($self->{bullet}) + length($self->{indent}) == length($indent))) {
  410.                 $paragraph .= $text."\n";
  411.             else {
  412.                 do_paragraph($self,$paragraph,$wrapped_mode);
  413.                 $paragraph $text."\n";
  414.                 $self->{indent} = $indent;
  415.                 $self->{bullet} = "";
  416.             }
  417.         elsif (   $line =~ /^=*$/
  418.                  or $line =~ /^_*$/
  419.                  or $line =~ /^-*$/) {
  420.             $wrapped_mode 0;
  421.             $paragraph .= $line."\n";
  422.             do_paragraph($self,$paragraph,$wrapped_mode);
  423.             $paragraph="";
  424.             $wrapped_mode 1;
  425.         elsif ($markdown and
  426.                  (   $line =~ /^#/            # headline
  427.                   or $line =~ /^\s*\[\[\!\S[^\]]*\]\]\s*$/)) { # sole macro
  428.             # Found Markdown markup that should be preserved as a single line
  429.             do_paragraph($self,$paragraph,$wrapped_mode);
  430.             $paragraph="$line\n";
  431.             $wrapped_mode 0;
  432.             do_paragraph($self,$paragraph,$wrapped_mode);
  433.             $wrapped_mode 1;
  434.             $paragraph="";
  435.         elsif ($markdown and
  436.                  (   $paragraph =~ m/^>/       # blockquote
  437.                   or $paragraph =~ m/[<>]/     # maybe html
  438.                   or $paragraph =~ m/^"""/     # textblock inside macro end
  439.                   or $paragraph =~ m/"""$/)) { # textblock inside macro begin
  440.             # Found Markdown markup that might not survive wrapping
  441.             $wrapped_mode 0;
  442.             $paragraph .= $line."\n";
  443.         else {
  444.             if ($line =~ /^\s/) {
  445.                 # A line starting by a space indicates a non-wrap
  446.                 # paragraph
  447.                 $wrapped_mode 0;
  448.             else {
  449.                 undef $self->{bullet};
  450.                 undef $self->{indent};
  451.             }
  452.             if ($fortunes) {
  453.                 $line =~ s/%%(.*)$//;
  454.             }
  455. # TODO: comments
  456.             $paragraph .= $line."\n";
  457.         }
  458.         # paragraphs starting by a bullet, or numbered
  459.         # or paragraphs with a line containing many consecutive spaces
  460.         # (more than 3)
  461.         # are considered as verbatim paragraphs
  462.         $wrapped_mode if (   $paragraph =~ m/^(\*|[0-9]+[.)] )/s
  463.                               or $paragraph =~ m/[ \t][ \t][ \t]/s);
  464.         ($line,$ref)=$self->shiftline();
  465.     }
  466.     if (length $paragraph) {
  467.         do_paragraph($self,$paragraph,$wrapped_mode);
  468.     }
  469. }
  470. sub do_paragraph {
  471.     my ($self$paragraph$wrap) = (shiftshiftshift);
  472.     my $type shift || $self->{type} || "Plain text";
  473.     return if ($paragraph eq "");
  474. # DEBUG
  475. #    my $b;
  476. #    if (defined $self->{bullet}) {
  477. #            $b = $self->{bullet};
  478. #    } else {
  479. #            $b = "UNDEF";
  480. #    }
  481. #    $type .= " verbatim: '".($self->{verbatim}||"NONE")."' bullet: '$b' indent: '".($self->{indent}||"NONE")."' type: '".($self->{type}||"NONE")."'";
  482.     if ($bullets and not $wrap and not defined $self->{verbatim}) {
  483.         # Detect bullets
  484.         # |        * blah blah
  485.         # |<spaces>  blah
  486.         # |          ^-- aligned
  487.         # <empty line>
  488.         #
  489.         # Other bullets supported:
  490.         # - blah         o blah         + blah
  491.         # 1. blah       1) blah       (1) blah
  492. TEST_BULLET:
  493.         if ($paragraph =~ m/^(\s*)((?:[-*o+]|([0-9]+[.\)])|\([0-9]+\))\s+)([^\n]*\n)(.*)$/s) {
  494.             my $para $5;
  495.             my $bullet $2;
  496.             my $indent1 $1;
  497.             my $indent2 "$1".(' ' x length $bullet);
  498.             my $text $4;
  499.             while ($para !~ m/$indent2(?:[-*o+]|([0-9]+[.\)])|\([0-9]+\))\s+/
  500.                    and $para =~ s/^$indent2(\S[^\n]*\n)//s) {
  501.                 $text .= $1;
  502.             }
  503.             # TODO: detect if a line starts with the same bullet
  504.             if ($text !~ m/\S[ \t][ \t][ \t]+\S/s) {
  505.                 my $bullet_regex quotemeta($indent1.$bullet);
  506.                 $bullet_regex =~ s/[0-9]+/\\d\+/;
  507.                 if ($para eq '' or $para =~ m/^$bullet_regex\S/s) {
  508.                     my $trans $self->translate($text,
  509.                                                  $self->{ref},
  510.                                                  "Bullet: '$indent1$bullet'",
  511.                                                  "wrap" => 1,
  512.                                                  "wrapcol" => - (length $indent2));
  513.                     $trans =~ s/^/$indent1$bullet/s;
  514.                     $trans =~ s/\n(.)/\n$indent2$1/sg;
  515.                     $self->pushline$trans."\n" );
  516.                     if ($para eq '') {
  517.                         return;
  518.                     else {
  519.                         # Another bullet
  520.                         $paragraph $para;
  521.                         goto TEST_BULLET;
  522.                     }
  523.                 }
  524.             }
  525.         }
  526.     }
  527.     my $end "";
  528.     if ($wrap) {
  529.         $paragraph =~ s/^(.*?)(\n*)$/$1/s;
  530.         $end $2 || "";
  531.     }
  532.     my $t $self->translate($paragraph,
  533.                              $self->{ref},
  534.                              $type,
  535.                              "wrap" => $wrap);
  536.     if (defined $self->{bullet}) {
  537.         my $bullet $self->{bullet};
  538.         my $indent1 $self->{indent};
  539.         my $indent2 $indent1.(' ' x length($bullet));
  540.         $t =~ s/^/$indent1$bullet/s;
  541.         $t =~ s/\n(.)/\n$indent2$1/sg;
  542.     }
  543.     $self->pushline$t.$end );
  544. }
  545. 1;
  546. =head1 STATUS OF THIS MODULE
  547. Tested successfully on simple text files and NEWS.Debian files.
  548. =head1 AUTHORS
  549.  Nicolas François <nicolas.francois@centraliens.net>
  550. =head1 COPYRIGHT AND LICENSE
  551.  Copyright 2005-2008 by Nicolas FRANÇOIS <nicolas.francois@centraliens.net>.
  552. This program is free software; you may redistribute it and/or modify it
  553. under the terms of GPL (see the COPYING file).