[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve... |
Date: |
Tue, 28 Dec 2010 19:05:03 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/12/28 19:05:02
Modified files:
tp : TODO
tp/Texinfo : Parser.pm
tp/Texinfo/Convert: Info.pm Plaintext.pm
tp/t/results/coverage_braces: space_in_image.pl
tp/t/results/paragraph: no_paragraph_commands.pl
Log message:
Handle @image in Info.
Better counting and locations.
Add an output file as argument for the converter.
Prepare the info header.
Handle @direntry and @dircategory.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.169&r2=1.170
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage_braces/space_in_image.pl?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/paragraph/no_paragraph_commands.pl?cvsroot=texinfo&r1=1.18&r2=1.19
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- TODO 7 Dec 2010 10:10:51 -0000 1.62
+++ TODO 28 Dec 2010 19:05:01 -0000 1.63
@@ -8,6 +8,10 @@
could be used for the main loop. More simply, a binary tokenizer, at
least, could make for a notable speedup.
+pass 'output_file' to Plaintext.pm. Use it to output the result
+(if defined). Maybe use a different call than convert?
+In Info always ouput to a file unless output_file is -.
+
for i18n, one want to do something like
{style} {number}: {caption}
-> new tree.
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- Texinfo/Parser.pm 19 Dec 2010 17:25:05 -0000 1.169
+++ Texinfo/Parser.pm 28 Dec 2010 19:05:01 -0000 1.170
@@ -3137,7 +3137,7 @@
if (!$self->_register_global_command($command, $misc, $line_nr)
and $command eq 'dircategory') {
- push @{$self->{'extra'}->{'dircategory_direntry'}}, $misc;
+ push @{$self->{'info'}->{'dircategory_direntry'}}, $misc;
}
# @-command with matching @end
} elsif (exists($block_commands{$command})) {
@@ -3240,7 +3240,7 @@
if ($preformatted_commands{$command});
if ($menu_commands{$command}) {
push @{$self->{'context_stack'}}, 'menu';
- push @{$self->{'extra'}->{'dircategory_direntry'}}, $block
+ push @{$self->{'info'}->{'dircategory_direntry'}}, $block
if ($command eq 'direntry');
if ($self->{'current_node'}) {
if ($command eq 'direntry' and $self->{'menus'}) {
Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Texinfo/Convert/Info.pm 21 Dec 2010 01:27:31 -0000 1.3
+++ Texinfo/Convert/Info.pm 28 Dec 2010 19:05:02 -0000 1.4
@@ -46,6 +46,92 @@
$VERSION = '0.01';
+my $STDIN_DOCU_NAME = 'stdin';
+my $INFO_EXTENSION = 'info';
+
+sub convert($)
+{
+ my $self = shift;
+ my $root = shift;
+
+ my $result = '';
+
+ my $header = $self->_info_header();
+ my $elements = Texinfo::Structuring::split_by_node($root);
+ if (!defined($elements)) {
+ ($result) = $self->_convert($root);
+ my ($footnotes) = $self->_footnotes();
+ $result .= $footnotes;
+ } else {
+ foreach my $node (@$elements) {
+ my ($node_text) = $self->_convert_node($node);
+ $result .= $node_text;
+ }
+ }
+ return $header.$result;
+}
+
+sub _info_header($)
+{
+ my $self = shift;
+ return $self->{'info_header'} if (defined($self->{'info_header'}));
+ my $input_basename;
+ if (defined($self->{'info'}->{'input_file_name'})) {
+ $input_basename = $self->{'info'}->{'input_file_name'};
+ } else {
+ $input_basename = '';
+ }
+ $input_basename =~ s/^.*\///;
+ $input_basename = $STDIN_DOCU_NAME if ($input_basename eq '-');
+ my $output_file;
+ if (defined($self->{'output_file'})) {
+ $output_file = $self->{'output_file'};
+ } elsif ($self->{'extra'} and $self->{'extra'}->{'setfilename'}
+ and $self->{'extra'}->{'setfilename'}->{'extra'}
+ and
defined($self->{'extra'}->{'setfilename'}->{'extra'}->{'text_arg'})) {
+ $output_file = $self->{'extra'}->{'setfilename'}->{'extra'}->{'text_arg'};
+ $output_file =~ s/^.*\///;
+ } elsif ($input_basename ne '') {
+ $output_file = $input_basename;
+ $output_file =~ s/\.te?x(i|info)?$//;
+ $output_file .= '.'.$INFO_EXTENSION;
+ } else {
+ $output_file = '';
+ }
+ #Â FIXME version/program
+ my $text = "This is $output_file, produced by makeinfo version 4.13 from
$input_basename.";
+ my $paragraph = Texinfo::Convert::Paragraph->new();
+ my $result = $paragraph->add_text($text);
+ $result .= $paragraph->end();
+ $result .= "\n\n";
+ if ($self->{'extra'} and $self->{'extra'}->{'copying'}) {
+ my $options = {};
+ if ($self->{'enable_encoding'}) {
+ $options->{'enabled_encoding'} = $self->{'encoding'};
+ }
+ $result .= Texinfo::Convert::Text::convert({'contents' =>
+ $self->{'extra'}->{'copying'}->{'contents'}},
+ $options);
+ }
+ if ($self->{'info'}->{'dircategory_direntry'}) {
+ $self->{'ignored_commands'}->{'direntry'} = 0;
+ foreach my $command (@{$self->{'info'}->{'dircategory_direntry'}}) {
+ if ($command->{'cmdname'} eq 'dircategory') {
+ if ($command->{'extra'}
+ and defined($command->{'extra'}->{'text_arg'})) {
+ $result .= "\nINFO-DIR-SECTION $command->{'extra'}->{'text_arg'}\n";
+ }
+ } elsif ($command->{'cmdname'} eq 'direntry') {
+ $result .= "START-INFO-DIR-ENTRY\n";
+ my ($direntry) = $self->_convert($command);
+ $result .= $direntry;
+ $result .= "END-INFO-DIR-ENTRY\n";
+ }
+ }
+ $self->{'ignored_commands'}->{'direntry'} = 1;
+ }
+ return $result;
+}
sub count_bytes($$)
{
@@ -68,14 +154,15 @@
my $counts = shift;
my $locations = shift;
if ($locations) {
- foreach my $line_location (@{$locations->{'lines'}}) {
- $line_location->{'lines_count'} += $$main_lines_count;
+ foreach my $location(@$locations) {
+ if (defined($location->{'lines'})) {
+ $location->{'lines'} += $$main_lines_count;
+ }
+ if (defined($location->{'bytes'})) {
+ $location->{'bytes'} += $$main_bytes_count;
}
- foreach my $byte_location (@{$locations->{'bytes'}}) {
- $byte_location->{'bytes_count'} += $$main_bytes_count;
}
- push @{$main_locations->{'lines'}}, @{$locations->{'lines'}};
- push @{$main_locations->{'bytes'}}, @{$locations->{'bytes'}};
+ push @{$main_locations}, @{$locations};
}
if ($counts) {
$$main_bytes_count += $counts->{'bytes'};
@@ -136,7 +223,6 @@
return '';
}
-
my $index_length_to_node = 41;
sub _printindex($$)
@@ -177,7 +263,7 @@
foreach my $entry (@{$self->{'index_entries'}->{$index_name}}) {
my $line_nr;
if (defined ($self->{'index_entries_line_location'}->{$entry})) {
- $line_nr =
$self->{'index_entries_line_location'}->{$entry}->{'lines_count'};
+ $line_nr = $self->{'index_entries_line_location'}->{$entry}->{'lines'};
}
if (!defined($entry->{'node'})) {
$line_nr = 0;
@@ -308,6 +394,74 @@
{
my $self = shift;
my $anchor = shift;
+
+ # 'lines_count' is in fact only needed when in @flush and @multitable
+ my $locations = [ {'lines' => 0, 'bytes' => 0,
+ 'root' => $anchor} ];
+ return ('', undef, $locations);
+}
+
+my @image_files_extensions = ('png', 'jpg');
+sub _image($$)
+{
+ my $self = shift;
+ my $root = shift;
+ my @extensions = @image_files_extensions;
+
+
+ if (defined($root->{'extra'}->{'brace_command_contents'}->[0])) {
+ my $basefile = Texinfo::Convert::Text::convert(
+ {'contents' => $root->{'extra'}->{'brace_command_contents'}->[0]});
+ if (defined($root->{'extra'}->{'brace_command_contents'}->[4])) {
+ my $extension = Texinfo::Convert::Text::convert(
+ {'contents' => $root->{'extra'}->{'brace_command_contents'}->[4]});
+ unshift @extensions, ".$extension";
+ unshift @extensions, "$extension";
+ }
+ my $image_file;
+ foreach my $extension (@extensions) {
+ $image_file =
+ $self->Texinfo::Parser::_locate_include_file ($basefile.$extension);
+ if (defined($image_file)) {
+ last;
+ }
+ }
+ my $txt_file =
+ $self->Texinfo::Parser::_locate_include_file ($basefile.'.txt');
+ my $text = $self->_image_text($root, $basefile);
+ if (defined($text)) {
+ if (!$self->{'formatters'}->[-1]->{'_top_formatter'}) {
+ $text = '['.$text.']';
+ }
+ }
+
+ my $result;
+
+ if (defined($image_file)) {
+ $image_file =~ s/\\/\\\\/g;
+ $image_file =~ s/\"/\\\"/g;
+ $result = "\x{00}\x{08}[image src=\"$image_file\"";
+
+ if (defined($root->{'extra'}->{'brace_command_contents'}->[3])) {
+ my $alt = Texinfo::Convert::Text::convert(
+ {'contents' => $root->{'extra'}->{'brace_command_contents'}->[3]});
+ $alt =~ s/\\/\\\\/g;
+ $alt =~ s/\"/\\\"/g;
+ $result .= " alt=\"$alt\"";
+ }
+ if (defined($text)) {
+ $text =~ s/\\/\\\\/g;
+ $text =~ s/\"/\\\"/g;
+ $result .= " text=\"$text\"";
+ }
+ $result .= "\x{00}\x{08}]";
+ } else {
+ $result = $text;
+ }
+ if (defined($result)) {
+ return $result;
+ }
+ }
return '';
}
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- Texinfo/Convert/Plaintext.pm 21 Dec 2010 01:27:31 -0000 1.39
+++ Texinfo/Convert/Plaintext.pm 28 Dec 2010 19:05:02 -0000 1.40
@@ -165,7 +165,7 @@
}
foreach my $ignored_block_commands ('ignore', 'macro', 'rmacro', 'copying',
- 'documentdescription', 'titlepage') {
+ 'documentdescription', 'titlepage', 'direntry') {
$ignored_commands{$ignored_block_commands} = 1;
}
@@ -233,6 +233,7 @@
'documentencoding' => 'us-ascii',
'encoding' => 'us-ascii',
'output_encoding' => 'us-ascii',
+ 'output_file' => undef,
'documentlanguage' => 'en',
'number_footnotes' => 1,
'split_size' => 300000,
@@ -283,6 +284,7 @@
$converter->{'parser'} = $conf->{'parser'};
$converter->{'extra'}
= $converter->{'parser'}->global_commands_information();
+ $converter->{'info'} = $converter->{'parser'}->global_informations();
my $floats = $converter->{'parser'}->floats_information();
$converter->{'structuring'} = $converter->{'parser'}->{'structuring'};
@@ -359,7 +361,7 @@
my $result = '';
my $bytes_count = 0;
my $lines_count = 0;
- my $locations = {};
+ my $locations = [];
$self->advance_count_text(\$result, \$bytes_count, \$lines_count,
$locations, 0, $self->_convert($node));
@@ -367,18 +369,18 @@
$self->advance_count_text(\$result, \$bytes_count, \$lines_count,
$locations, 0, $self->_footnotes($node));
- foreach my $location (@{$locations->{'bytes'}}) {
- $location->{'bytes_count'} += $self->{'file_bytes_count'};
- $self->{'label_locations'}->{$location->{'anchor'}} =
$location->{'anchor'};
+ foreach my $location (@{$locations}) {
+ if (defined($location->{'bytes'})) {
+ $location->{'bytes'} += $self->{'file_bytes_count'};
+ $self->{'label_locations'}->{$location->{'root'}} = $location->{'root'};
}
- foreach my $location (@{$locations->{'lines'}}) {
- if ($location->{'index_entry'}) {
+ if (defined($location->{'lines'} and $location->{'index_entry'})) {
$self->{'index_entries_line_location'}->{$location->{'index_entry'}} =
$location;
}
}
$self->{'file_bytes_count'} += $bytes_count;
- return ($result, {'lines' => $lines_count, 'bytes' => $bytes_count},
- $locations);
+ #Â FIXME return $locations?
+ return ($result, {'lines' => $lines_count, 'bytes' => $bytes_count});
}
sub convert($)
@@ -412,7 +414,7 @@
return $text;
}
-sub process_text($$$)
+sub _process_text($$$)
{
my $self = shift;
my $command = shift;
@@ -562,14 +564,15 @@
my $counts = shift;
my $locations = shift;
if ($locations) {
- foreach my $line_location (@{$locations->{'lines'}}) {
- $line_location->{'lines_count'} += $$main_lines_count;
+ foreach my $location(@$locations) {
+ if (defined($location->{'lines'})) {
+ $location->{'lines'} += $$main_lines_count;
}
- foreach my $byte_location (@{$locations->{'bytes'}}) {
- $byte_location->{'bytes_count'} += $$main_bytes_count;
+ if (defined($location->{'bytes'})) {
+ $location->{'bytes'} += $$main_bytes_count;
}
- push @{$main_locations->{'lines'}}, @{$locations->{'lines'}};
- push @{$main_locations->{'bytes'}}, @{$locations->{'bytes'}};
+ }
+ push @{$main_locations}, @{$locations};
}
if ($counts) {
$$main_bytes_count += $counts->{'bytes'};
@@ -585,15 +588,18 @@
my $bytes_count = 0;
my $lines_count = 0;
- my $locations = {};
+ my $locations = [];
my $result = '';
if (scalar(@{$self->{'pending_footnotes'}})) {
unless ($self->{'empty_lines_count'}) {
$result .= "\n";
+ $bytes_count += $self->count_bytes("\n");
$lines_count++;
}
if ($self->{'footnotestyle'} eq 'end' or !defined($element)) {
- $result .= " ---------- Footnotes ----------\n\n";
+ my $footnotes_header = " ---------- Footnotes ----------\n\n";
+ $result .= $footnotes_header;
+ $bytes_count += $self->count_bytes($footnotes_header);
$lines_count += 2;
} else {
@@ -606,7 +612,6 @@
$self->advance_count_text(\$result, \$bytes_count, \$lines_count,
$locations, 0, $self->_node($footnotes_node));
}
- $bytes_count = $self->count_bytes($result);
while (@{$self->{'pending_footnotes'}}) {
my $footnote = shift (@{$self->{'pending_footnotes'}});
#Â this pushes on 'context', 'format_context' and 'formatters'
@@ -625,6 +630,7 @@
$result .= "\n";
$bytes_count += $self->count_bytes("\n");
$lines_count++;
+ $self->{'empty_lines_count'} = 1;
}
pop @{$self->{'context'}};
@@ -719,6 +725,20 @@
return $result;
}
+sub _menu($$)
+{
+ my $self = shift;
+ my $menu_command = shift;
+
+ if ($menu_command->{'cmdname'} eq 'menu') {
+ my $result = "* Menu:\n\n";
+ return ($result, {'bytes' => $self->count_bytes($result),
+ 'lines' => 2});
+ } else {
+ return '';
+ }
+}
+
sub _printindex($$)
{
my $self = shift;
@@ -772,9 +792,57 @@
}
}
-# on top, the converter object which holds some gloal information
+sub _image_text($$$)
+{
+ my $self = shift;
+ my $root = shift;
+ my $basefile = shift;
+
+ my $txt_file = $self->Texinfo::Parser::_locate_include_file
($basefile.'.txt');
+ if (!defined($txt_file)) {
+ $self->line_warn(sprintf($self->__("Cannot find address@hidden file
`%s.txt'"), $basefile), $root->{'line_nr'});
+ } else {
+ if (open (TXT, $txt_file)) {
+ # FIXME encoding
+ # my $in_encoding = get_conf('IN_ENCODING');
+ # binmode(TXT, ":encoding($in_encoding)");
+ my $result = '';
+ while (<TXT>) {
+ $result .= $_;
+ }
+ # remove last end of line
+ chomp ($result);
+ close (TXT);
+ return $result;
+ } else {
+ $self->line_warn(sprintf($self->__("address@hidden file `%s' unreadable:
%s"), $txt_file, $!), $root->{'line_nr'});
+ }
+ }
+ return undef;
+}
+
+sub _image($$)
+{
+ my $self = shift;
+ my $root = shift;
+
+ if (defined($root->{'extra'}->{'brace_command_contents'}->[0])) {
+ my $basefile = Texinfo::Convert::Text::convert(
+ {'contents' => $root->{'extra'}->{'brace_command_contents'}->[0]});
+ my $result = $self->_image_text($root, $basefile);
+ if (defined($result)) {
+ if (!$self->{'formatters'}->[-1]->{'_top_formatter'}) {
+ $result = '['.$result.']';
+ }
+ return $result;
+ }
+ }
+ return '';
+}
+
+# on top, the converter object which holds some global information
#
-# context (for footntes, multitable cells):
+# context (for footnotes, multitable cells):
# 'preformatted'
# 'max'
#
@@ -836,13 +904,13 @@
my $result = '';
my $bytes_count = 0;
my $lines_count = 0;
- my $locations = {};
+ my $locations = [];
if (defined($root->{'text'})) {
if (!$formatter->{'_top_formatter'}) {
$result = $formatter->{'container'}->add_text(
- $self->process_text($root, $formatter));
+ $self->_process_text($root, $formatter));
return ($result, {'bytes' => $self->count_bytes($result)});
#Â the following is only possible if paragraphindent is set to asis
} elsif ($root->{'type'} and $root->{'type'} eq
'empty_spaces_before_paragraph') {
@@ -934,35 +1002,9 @@
return ($result, {'lines' => $lines_count, 'bytes' => $bytes_count},
$locations);
} elsif ($root->{'cmdname'} eq 'image') {
- if (defined($root->{'extra'}->{'brace_command_contents'}->[0])) {
- my $basefile = Texinfo::Convert::Text::convert(
- {'contents' => $root->{'extra'}->{'brace_command_contents'}->[0]});
- my $txt_file =
- $self->Texinfo::Parser::_locate_include_file ($basefile.'.txt');
- if (!defined($txt_file)) {
- $self->line_warn(sprintf($self->__("Cannot find address@hidden file
`%s.txt'"), $basefile), $root->{'line_nr'});
- } else {
- if (open (TXT, $txt_file)) {
- # FIXME encoding
- # my $in_encoding = get_conf('IN_ENCODING');
- # binmode(TXT, ":encoding($in_encoding)");
- my $top_level = 1;
- if (!$self->{'formatters'}->[-1]->{'_top_formatter'}) {
- $result .='[';
- }
- while (<TXT>) {
- $result .= $_;
- }
- if (!$self->{'formatters'}->[-1]->{'_top_formatter'}) {
- $result .=']';
- }
- close (TXT);
- } else {
- $self->line_warn(sprintf($self->__("address@hidden file `%s'
unreadable: %s"), $txt_file, $!), $root->{'line_nr'});
- }
- }
- return $result;
- }
+ #Â FIXME count lines
+ $result = $self->_image($root);
+ return ($result, {'bytes' => $self->count_bytes($result)});
} elsif ($root->{'cmdname'} eq 'email') {
# nothing is output for email, instead the command is substituted.
my @email_contents;
@@ -1167,11 +1209,9 @@
Texinfo::Convert::Unicode::string_width($result);
$self->{'empty_lines_count'} = 0 unless ($result eq '');
}
- } elsif ($root->{'cmdname'} eq 'menu') {
- my $begin = "* Menu:\n\n";
- $result .= $begin;
- $lines_count += 2;
- $bytes_count += $self->count_bytes($begin);
+ } elsif ($menu_commands{$root->{'cmdname'}}) {
+ $self->advance_count_text(\$result, \$bytes_count, \$lines_count,
+ $locations, 0, $self->_menu($root));
} elsif ($root->{'cmdname'} eq 'multitable') {
my $columnsize;
if ($root->{'extra'}->{'columnfractions'}) {
@@ -1235,9 +1275,6 @@
'contents' => $contents}]
}];
}
- my ($text, $counts, $new_locations)
- = $self->convert_line({'contents' => $contents},
- {'indent_level' => $self->{'format_context'}->[-1]->{'indent_level'}
-1});
$self->advance_count_text(\$result, \$bytes_count, \$lines_count,
$locations, 1, $self->convert_line({'contents' => $contents},
{'indent_level'
@@ -1292,7 +1329,7 @@
}
$cell = 1;
} elsif ($root->{'cmdname'} eq 'center') {
- my ($counts, $new_locations);
+ #my ($counts, $new_locations);
$self->advance_count_text(\$result, \$bytes_count, \$lines_count,
$locations, 0,
$self->convert_line (
@@ -1480,7 +1517,7 @@
if ($root->{'cmdname'} eq 'item' or $root->{'cmdname'} eq 'itemx') {
$index_entry = 0;
}
- push @{$locations->{'lines'}}, {'lines_count' => $lines_count,
+ push @{$locations}, {'lines' => $lines_count,
'index_entry' => $root};
} elsif ($unknown_command) {
die "Unhandled $root->{'cmdname'}\n";
@@ -1503,6 +1540,19 @@
$paragraph = $self->new_formatter('paragraph', $conf);
push @{$self->{'formatters'}}, $paragraph;
$self->{'format_context'}->[-1]->{'paragraph_count'}++;
+ } elsif ($root->{'type'} eq 'empty_line') {
+ print STDERR "EMPTY_LINE ($self->{'empty_lines_count'})\n"
+ if ($self->{'debug'});
+ delete $self->{'format_context'}->[-1]->{'counter'};
+ $self->{'empty_lines_count'}++;
+ if ($self->{'empty_lines_count'} <= 1
+ or $self->{'context'}->[-1] eq 'preformatted') {
+ $result = "\n";
+ $lines_count = 1;
+ return ("\n", {'bytes' => $self->count_bytes("\n"), 'lines'=> 1});
+ } else {
+ return '';
+ }
} elsif ($root->{'type'} eq 'def_line') {
if ($root->{'extra'} and $root->{'extra'}->{'def_args'}
and @{$root->{'extra'}->{'def_args'}}) {
@@ -1575,21 +1625,12 @@
push @{$self->{'current_contents'}}, address@hidden;
while (@contents) {
my $content = shift @contents;
- if ($content->{'type'} and $content->{'type'} eq 'empty_line') {
- print STDERR "EMPTY_LINE ($self->{'empty_lines_count'})\n"
- if ($self->{'debug'});
- $result .= "\n" if (!$self->{'empty_lines_count'}
- or $self->{'context'}->[-1] eq 'preformatted');
- $self->{'empty_lines_count'}++;
- delete $self->{'format_context'}->[-1]->{'counter'};
- } else {
my ($text, $counts, $new_locations)
= $self->_convert($content);
-
- $result .= $text;
+ $self->advance_count_text(\$result, \$bytes_count, \$lines_count,
+ $locations, 0, $text, $counts, $new_locations);
$self->{'empty_lines_count'} = 0 if ($preformatted and $text ne '');
}
- }
pop @{$self->{'current_contents'}};
}
@@ -1676,7 +1717,10 @@
}
}
if ($paragraph) {
- $result .= $paragraph->{'container'}->end();
+ my $end = $paragraph->{'container'}->end();
+ $result .= $end;
+ $bytes_count += $self->count_bytes($end);
+ $lines_count += $paragraph->{'container'}->{'lines_counter'};
if ($self->{'context'}->[-1] eq 'flush') {
$result = $self->_flush_paragraph ($result);
}
Index: t/results/coverage_braces/space_in_image.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/coverage_braces/space_in_image.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- t/results/coverage_braces/space_in_image.pl 7 Dec 2010 23:18:30 -0000
1.13
+++ t/results/coverage_braces/space_in_image.pl 28 Dec 2010 19:05:02 -0000
1.14
@@ -197,9 +197,7 @@
-$result_converted{'plaintext'}->{'space_in_image'} = 'An image text before
paragraph.
-.[Another image text, in paragraph.
-] .
+$result_converted{'plaintext'}->{'space_in_image'} = 'An image text before
paragraph..[Another image text, in paragraph.] .
';
1;
Index: t/results/paragraph/no_paragraph_commands.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/paragraph/no_paragraph_commands.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- t/results/paragraph/no_paragraph_commands.pl 7 Dec 2010 23:18:30
-0000 1.18
+++ t/results/paragraph/no_paragraph_commands.pl 28 Dec 2010 19:05:02
-0000 1.19
@@ -180,7 +180,6 @@
$result_converted{'plaintext'}->{'no_paragraph_commands'} = '
title font
**********
-Text for image out of paragraph.
-';
+Text for image out of paragraph.';
1;