[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5212] * tp/t/test_utils.pl: close generated files before doing
From: |
Patrice Dumas |
Subject: |
[5212] * tp/t/test_utils.pl: close generated files before doing the comparison. |
Date: |
Thu, 28 Feb 2013 08:08:08 +0000 |
Revision: 5212
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5212
Author: pertusus
Date: 2013-02-28 08:07:53 +0000 (Thu, 28 Feb 2013)
Log Message:
-----------
* tp/t/test_utils.pl: close generated files before doing the comparison.
* tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Info.pm:
cache get_conf() results. Convert node names only once.
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/TODO
trunk/tp/Texinfo/Convert/Info.pm
trunk/tp/Texinfo/Convert/Plaintext.pm
trunk/tp/Texinfo/Parser.pm
trunk/tp/Texinfo/Structuring.pm
trunk/tp/maintain/all_tests.sh
trunk/tp/t/results/converters_tests/at_commands_in_refs.pl
trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
trunk/tp/t/results/test_count/printindex.pl
trunk/tp/t/test_utils.pl
trunk/tp/texi2any.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/ChangeLog 2013-02-28 08:07:53 UTC (rev 5212)
@@ -1,3 +1,9 @@
+2013-02-28 Patrice Dumas <address@hidden>
+
+ * tp/t/test_utils.pl: close generated files before doing the comparison.
+ * tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Info.pm:
+ cache get_conf() results. Convert node names only once.
+
2013-02-26 Karl Berry <address@hidden>
* doc/texinfo.txi (Generating HTML, HTML CSS): xref to
Modified: trunk/tp/TODO
===================================================================
--- trunk/tp/TODO 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/TODO 2013-02-28 08:07:53 UTC (rev 5212)
@@ -18,6 +18,17 @@
====
+Profiling
+=========
+
+profiling: package on debian:
+libdevel-nytprof-perl
+In doc:
+perl -d:NYTProf ../tp/texi2any.pl texinfo.txi
+nytprofhtml --open
+# firefox nytprof/index.html
+
+
Delayed bugs
============
Modified: trunk/tp/Texinfo/Convert/Info.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Info.pm 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/Texinfo/Convert/Info.pm 2013-02-28 08:07:53 UTC (rev 5212)
@@ -250,10 +250,7 @@
}
$prefix = 'Ref';
}
- push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
- my $label_text = _normalize_top_node($self->convert_line({'type' =>
'_code',
- 'contents' => $label->{'root'}->{'extra'}->{'node_content'}}));
- pop @{$self->{'count_context'}};
+ my ($label_text, $byte_count) = $self->_node_line($label->{'root'});
$tag_text .= "$prefix: $label_text\x{7F}$label->{'bytes'}\n";
}
$tag_text .= "\x{1F}\nEnd Tag Table\n";
@@ -362,12 +359,6 @@
}
}
-sub _normalize_top_node($)
-{
- my $node = shift;
- return Texinfo::Common::normalize_top_node_name($node);
-}
-
my @directions = ('Next', 'Prev', 'Up');
sub _node($$)
{
@@ -393,8 +384,8 @@
my $node_begin = "\x{1F}\nFile: $output_filename, Node: ";
$result .= $node_begin;
$self->_add_text_count($node_begin);
- my $node_text = _normalize_top_node($self->convert_line({'type' => '_code',
- 'contents' => $node->{'extra'}->{'node_content'}}));
+ my ($node_text, $byte_count) = $self->_node_line($node);
+ $self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
$result .= $node_text;
foreach my $direction(@directions) {
if ($node->{'node_'.lc($direction)}) {
@@ -409,8 +400,9 @@
{'text' => ')'}]});
}
if ($node_direction->{'extra'}->{'node_content'}) {
- $result .= _normalize_top_node($self->convert_line({'type' => '_code',
- 'contents' => $node_direction->{'extra'}->{'node_content'}}));
+ my ($node_text, $byte_count) = $self->_node_line($node_direction);
+ $self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
+ $result .= $node_text;
}
}
}
Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm 2013-02-27 00:55:04 UTC (rev
5211)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm 2013-02-28 08:07:53 UTC (rev
5212)
@@ -367,10 +367,23 @@
%{$self->{'style_map'}} = %style_map;
if ($self->get_conf('ENABLE_ENCODING') and
$self->get_conf('OUTPUT_ENCODING_NAME')
and $self->get_conf('OUTPUT_ENCODING_NAME') eq 'utf-8') {
+ # cache this to avoid redoing calls to get_conf
+ $self->{'to_utf8'} = 1;
foreach my $quoted_command (@quoted_commands) {
$self->{'style_map'}->{$quoted_command} = ["\x{2018}", "\x{2019}"];
}
}
+ # some caching to avoid calling get_conf
+ if ($self->get_conf('OUTPUT_PERL_ENCODING')) {
+ $self->{'output_perl_encoding'} = $self->get_conf('OUTPUT_PERL_ENCODING');
+ } else {
+ $self->{'output_perl_encoding'} = '';
+ }
+ $self->{'enable_encoding'} = $self->get_conf('ENABLE_ENCODING');
+ $self->{'output_encoding_name'} = $self->get_conf('OUTPUT_ENCODING_NAME');
+ $self->{'debug'} = $self->get_conf('DEBUG');
+ $self->{'convert_text_options'}
+ = {Texinfo::Common::_convert_text_options($self)};
if (defined($self->get_conf('OPEN_QUOTE_SYMBOL'))) {
foreach my $quoted_command (@quoted_commands) {
$self->{'style_map'}->{$quoted_command}->[0]
@@ -413,19 +426,19 @@
my $result = '';
- print STDERR "NEW NODE\n" if ($self->get_conf('DEBUG'));
+ print STDERR "NEW NODE\n" if ($self->{'debug'});
$result .= $self->_convert($element);
$self->_count_context_bug_message('', $element);
- print STDERR "END NODE
($self->{'count_context'}->[-1]->{'lines'},$self->{'count_context'}->[-1]->{'bytes'})\n"
if ($self->get_conf('DEBUG'));
+ print STDERR "END NODE
($self->{'count_context'}->[-1]->{'lines'},$self->{'count_context'}->[-1]->{'bytes'})\n"
if ($self->{'debug'});
$result .= $self->_footnotes($element);
$self->_count_context_bug_message('footnotes ', $element);
- print STDERR "AFTER FOOTNOTES
($self->{'count_context'}->[-1]->{'lines'},$self->{'count_context'}->[-1]->{'bytes'})\n"
if ($self->get_conf('DEBUG'));
+ print STDERR "AFTER FOOTNOTES
($self->{'count_context'}->[-1]->{'lines'},$self->{'count_context'}->[-1]->{'bytes'})\n"
if ($self->{'debug'});
return $result;
}
@@ -509,8 +522,7 @@
or $context->{'var'}) {
$lower_case_text = lc($text);
}
- if ($self->get_conf('ENABLE_ENCODING') and
$self->get_conf('OUTPUT_ENCODING_NAME')
- and $self->get_conf('OUTPUT_ENCODING_NAME') eq 'utf-8') {
+ if ($self->{'to_utf8'}) {
if (defined($lower_case_text)) {
$lower_case_text
= Texinfo::Convert::Unicode::unicode_text($lower_case_text,
@@ -560,7 +572,7 @@
$container_conf->{'counter'}
= $self->{'text_element_context'}->[-1]->{'counter'}
if (defined($self->{'text_element_context'}->[-1]->{'counter'}));
- $container_conf->{'DEBUG'} = 1 if ($self->get_conf('DEBUG'));
+ $container_conf->{'DEBUG'} = 1 if ($self->{'debug'});
if ($conf) {
foreach my $key (keys(%$conf)) {
$container_conf->{$key} = $conf->{$key};
@@ -610,7 +622,7 @@
}
}
}
- print STDERR "NEW FORMATTER($type)\n" if ($self->get_conf('DEBUG'));
+ print STDERR "NEW FORMATTER($type)\n" if ($self->{'debug'});
return $formatter;
}
@@ -649,7 +661,8 @@
my $self = shift;
my $string = shift;
- return Texinfo::Common::count_bytes($self, $string);
+ return Texinfo::Common::count_bytes($self, $string,
+ $self->{'output_perl_encoding'});
}
sub _add_text_count($$)
@@ -747,7 +760,7 @@
if (scalar(@{$self->{'pending_footnotes'}})) {
$result .= $self->_add_newline_if_needed();
print STDERR "FOOTNOTES ".scalar(@{$self->{'pending_footnotes'}})."\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
if ($self->get_conf('footnotestyle') eq 'end' or !defined($element)) {
my $footnotes_header = " ---------- Footnotes ----------\n\n";
$result .= $footnotes_header;
@@ -1073,6 +1086,31 @@
return $self->_printindex_formatted($printindex);
}
+sub _normalize_top_node($)
+{
+ my $node = shift;
+ return Texinfo::Common::normalize_top_node_name($node);
+}
+
+# cache formatted node line and returns it
+sub _node_line($$)
+{
+ my $self = shift;
+ my $node = shift;
+ if (!$self->{'node_lines_text'}->{$node}) {
+ my $node_text = {'type' => '_code',
+ 'contents' => $node->{'extra'}->{'node_content'}};
+ push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
+ $self->{'node_lines_text'}->{$node}->{'text'}
+ = _normalize_top_node($self->convert_line($node_text));
+ my $end_context = pop @{$self->{'count_context'}};
+ $self->{'node_lines_text'}->{$node}->{'count'}
+ = $end_context->{'bytes'};
+ }
+ return ($self->{'node_lines_text'}->{$node}->{'text'},
+ $self->{'node_lines_text'}->{$node}->{'count'});
+}
+
my $index_length_to_node = 41;
sub _printindex_formatted($$;$)
@@ -1203,11 +1241,23 @@
$entry_line .= $spaces;
$self->_add_text_count($spaces);
}
- my $node_text;
my $node = $entry_nodes{$entry};
if (!defined($node)) {
- $node_text = $self->gdt('(outside of any node)');
+ # cache the transformation to text and byte counting, as
+ # it is likeky that there is more than one such entry
+ if (!$self->{'outside_of_any_node_text'}) {
+ push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
+ my $node_text = $self->gdt('(outside of any node)');
+ $self->{'outside_of_any_node_text'}->{'text'}
+ = $self->convert_line($node_text);
+ my $end_context = pop @{$self->{'count_context'}};
+ $self->{'outside_of_any_node_text'}->{'count'}
+ = $end_context->{'bytes'};
+ }
+ $entry_line .= $self->{'outside_of_any_node_text'}->{'text'};
+ $self->{'count_context'}->[-1]->{'bytes'}
+ += $self->{'outside_of_any_node_text'}->{'count'};
# FIXME when outside of sectioning commands this message was already
# done by the Parser.
# Warn, only once.
@@ -1217,10 +1267,10 @@
$self->{'index_entries_no_node'}->{$entry} = 1;
}
} else {
- $node_text = {'type' => '_code',
- 'contents' => $node->{'extra'}->{'node_content'}};
+ my ($node_line, $byte_count) = $self->_node_line($node);
+ $entry_line .= $node_line;
+ $self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
}
- $entry_line .= $self->convert_line($node_text);
$entry_line .= '.';
$self->_add_text_count('.');
@@ -1350,7 +1400,7 @@
} elsif (defined($root->{'extra'}->{'brace_command_contents'}->[3])) {
$result = '[' .Texinfo::Convert::Text::convert(
{'contents' => $root->{'extra'}->{'brace_command_contents'}->[3]},
- {Texinfo::Common::_convert_text_options($self)}) .']';
+ $self->{'convert_text_options'}) .']';
} else {
$self->line_warn(sprintf($self->__(
"could not find address@hidden file `%s.txt' nor alternate
text"),
@@ -1368,7 +1418,7 @@
if (defined($root->{'extra'}->{'brace_command_contents'}->[0])) {
my $basefile = Texinfo::Convert::Text::convert(
{'contents' => $root->{'extra'}->{'brace_command_contents'}->[0]},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ {'code' => 1, %{$self->{'convert_text_options'}}});
my ($text, $width) = $self->_image_text($root, $basefile);
my $result = $self->_image_formatted_text($root, $basefile, $text);
my $lines_count = ($result =~ tr/\n/\n/);
@@ -1393,7 +1443,7 @@
my $formatter = $self->{'formatters'}->[-1];
- if ($self->get_conf('DEBUG')) {
+ if ($self->{'debug'}) {
my $is_top_formatter = 0;
$is_top_formatter = 1 if ($formatter->{'_top_formatter'});
my $empty_lines_count = '';
@@ -1430,7 +1480,7 @@
or ($inline_format_commands{$root->{'cmdname'}}
and (!$root->{'extra'}->{'format'}
or
!$self->{'expanded_formats_hash'}->{$root->{'extra'}->{'format'}}))))) {
- print STDERR "IGNORED\n" if ($self->get_conf('DEBUG'));
+ print STDERR "IGNORED\n" if ($self->{'debug'});
return '';
}
my $result = '';
@@ -1440,7 +1490,7 @@
# especially
if ($root->{'type'} and ($root->{'type'} eq 'empty_line'
or $root->{'type'} eq 'after_description_line')) {
- if ($self->get_conf('DEBUG')) {
+ if ($self->{'debug'}) {
my $count = $self->{'empty_lines_count'};
$count = '' if (!defined($count));
print STDERR "EMPTY_LINE ($count)\n";
@@ -1486,12 +1536,12 @@
if ($root->{'extra'}) {
#if ($root->{'extra'}->{'invalid_nesting'}) {
- # print STDERR "INVALID_NESTING\n" if ($self->get_conf('DEBUG'));
+ # print STDERR "INVALID_NESTING\n" if ($self->{'debug'});
# return '';
#} elsif ($root->{'extra'}->{'missing_argument'}
if ($root->{'extra'}->{'missing_argument'}
and (!$root->{'contents'} or address@hidden>{'contents'}})) {
- print STDERR "MISSING_ARGUMENT\n" if ($self->get_conf('DEBUG'));
+ print STDERR "MISSING_ARGUMENT\n" if ($self->{'debug'});
return '';
}
}
@@ -1530,7 +1580,7 @@
}
if (! $following_not_empty) {
print STDERR "INDEX ENTRY $root->{'cmdname'} followed by empty lines\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
$location->{'lines'}--;
}
}
@@ -1544,7 +1594,7 @@
}
$self->{'index_entries_line_location'}->{$root} = $location;
print STDERR "INDEX ENTRY lines_count $location->{'lines'}, index_entry
$location->{'index_entry'}\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
}
my $cell;
@@ -1577,22 +1627,20 @@
unshift @{$self->{'current_contents'}->[-1]}, $today;
} elsif (exists($brace_no_arg_commands{$root->{'cmdname'}})) {
my $text;
- my %text_options = Texinfo::Common::_convert_text_options($self);
$text = Texinfo::Convert::Text::brace_no_arg_command($root,
- {%text_options,
+ {%{$self->{'convert_text_options'}},
'sc' => $formatter->{'upper_case'}});
my $lower_case_text;
# always double spacing, so set underlying text lower case.
if ($formatter->{'var'}
or $formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
$lower_case_text = Texinfo::Convert::Text::brace_no_arg_command($root,
- {%text_options,
+ {%{$self->{'convert_text_options'}},
'lc' => 1});
} elsif ($formatter->{'upper_case'}) {
$lower_case_text = Texinfo::Convert::Text::brace_no_arg_command($root,
- {%text_options
- });
+ $self->{'convert_text_options'});
}
if ($punctuation_no_arg_commands{$command}) {
$result .= $self->_count_added($formatter->{'container'},
@@ -1626,8 +1674,8 @@
# commands with braces
} elsif ($accent_commands{$root->{'cmdname'}}) {
my $encoding;
- if ($self->get_conf('ENABLE_ENCODING')) {
- $encoding = $self->get_conf('OUTPUT_ENCODING_NAME');
+ if ($self->{'enable_encoding'}) {
+ $encoding = $self->{'output_encoding_name'};
}
my $sc;
if ($formatter->{'upper_case'}) {
@@ -2043,7 +2091,7 @@
and $root->{'args'}->[0]->{'type'}
and $root->{'args'}->[0]->{'type'} eq 'brace_command_arg') {
print STDERR "Unknown command with braces `$root->{'cmdname'}'\n"
- if ($self->get_conf('VERBOSE') or $self->get_conf('DEBUG'));
+ if ($self->get_conf('VERBOSE') or $self->{'debug'});
# block commands
} elsif (exists($block_commands{$root->{'cmdname'}})) {
# remark:
@@ -2128,13 +2176,13 @@
{'indent_length' =>
0});
pop @{$self->{'count_context'}};
print STDERR " MULTITABLE_PROTO {$formatted_prototype}\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
push @$columnsize,
2+Texinfo::Convert::Unicode::string_width($formatted_prototype);
}
}
print STDERR "MULTITABLE_SIZES @$columnsize\n" if ($columnsize
- and $self->get_conf('DEBUG'));
+ and $self->{'debug'});
$self->{'format_context'}->[-1]->{'columns_size'} = $columnsize;
$self->{'format_context'}->[-1]->{'row_empty_lines_count'}
= $self->{'empty_lines_count'};
@@ -2260,7 +2308,7 @@
$result .= $self->_count_added($line->{'container'},
$line->{'container'}->end());
print STDERR "
$root->{'parent'}->{'cmdname'}($root->{'extra'}->{'item_number'}) ->
|$result|\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
pop @{$self->{'formatters'}};
$self->{'text_element_context'}->[-1]->{'counter'} +=
Texinfo::Convert::Unicode::string_width($result);
@@ -2272,7 +2320,7 @@
$self->{'format_context'}->[-1]->{'item_command'} = $root->{'cmdname'}
if ($root->{'cmdname'} ne 'tab');
print STDERR "CELL [$root->{'extra'}->{'cell_number'}]:
address@hidden>{'cmdname'}. Width: $cell_width\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
die if (!defined($cell_width));
$self->{'empty_lines_count'}
= $self->{'format_context'}->[-1]->{'row_empty_lines_count'};
@@ -2482,7 +2530,7 @@
$self->{'empty_lines_count'} = 0;
my $conf;
# indent. Not first paragraph.
- if ($self->get_conf('DEBUG')) {
+ if ($self->{'debug'}) {
print STDERR "OPEN PARA ($self->{'format_context'}->[-1]->{'cmdname'})
"
. "cnt ".
(defined($self->{'text_element_context'}->[-1]->{'counter'}) ?
@@ -2697,7 +2745,7 @@
pop @{$self->{'formatters'}};
delete $self->{'text_element_context'}->[-1]->{'counter'};
$self->{'empty_lines_count'} = 0;
- print STDERR " --> $result" if ($self->get_conf('DEBUG'));
+ print STDERR " --> $result" if ($self->{'debug'});
}
} elsif ($root->{'type'} eq 'menu_entry') {
#my $menu_entry_internal_node;
@@ -2804,7 +2852,7 @@
push @{$cell_updated_locations->[$cell_idx]->{$location->{'lines'}}},
$location;
print STDERR "MULTITABLE anchor
$location->{'root'}->{'extra'}->{'normalized'}: c $cell_idx, l
$location->{'lines'} ($location->{'bytes'})\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
$max_lines = $location->{'lines'}+1
if ($location->{'lines'}+1 > $max_lines);
}
@@ -2813,7 +2861,7 @@
}
print STDERR "ROW, max_lines $max_lines, indent_len $indent_len\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
# this is used to keep track of the last cell with content.
my $max_cell = scalar(@{$self->{'format_context'}->[-1]->{'row'}});
@@ -2830,7 +2878,7 @@
or
defined($cell_updated_locations->[$cell_idx]->{$line_idx}));
}
print STDERR " L(last_cell $last_cell): $line_idx\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
for (my $cell_idx = 0; $cell_idx < $last_cell; $cell_idx++) {
my $cell_text = $cell_lines[$cell_idx]->[$line_idx];
@@ -2840,7 +2888,7 @@
$line = ' ' x $indent_len;
$bytes_count += $self->count_bytes($line);
}
- print STDERR " C($cell_idx) `$cell_text'\n" if
($self->get_conf('DEBUG'));
+ print STDERR " C($cell_idx) `$cell_text'\n" if ($self->{'debug'});
$line .= $cell_text;
$bytes_count += $self->count_bytes($cell_text);
$line_width += Texinfo::Convert::Unicode::string_width($cell_text);
@@ -2848,7 +2896,7 @@
if (defined($cell_updated_locations->[$cell_idx]->{$line_idx})) {
foreach my $location
(@{$cell_updated_locations->[$cell_idx]->{$line_idx}}) {
print STDERR "MULTITABLE UPDATE ANCHOR (l $line_idx, c
$cell_idx): $location->{'root'}->{'extra'}->{'normalized'}:
$location->{'bytes'} -> $bytes_count\n"
- if ($self->get_conf('DEBUG'));
+ if ($self->{'debug'});
$location->{'bytes'} = $bytes_count;
}
}
@@ -2924,7 +2972,7 @@
# close commands
if ($root->{'cmdname'}) {
if ($root->{'cmdname'} eq 'float') {
- if ($self->get_conf('DEBUG')) {
+ if ($self->{'debug'}) {
my $type_texi = '';
$type_texi = Texinfo::Convert::Texinfo::convert({'contents' =>
$root->{'extra'}->{'type'}->{'content'}})
if ($root->{'extra'} and $root->{'extra'}->{'type'}->{'normalized'}
ne '');
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/Texinfo/Parser.pm 2013-02-28 08:07:53 UTC (rev 5212)
@@ -1807,7 +1807,7 @@
or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_after_close_brace')) {
$no_merge_with_following_text = 1;
}
- if (_abort_empty_line ($self, $current, $leading_spaces)) {
+ if (_abort_empty_line($self, $current, $leading_spaces)) {
$text =~ s/^(\s+)//;
}
@@ -4037,7 +4037,7 @@
and $current->{'contents'}->[-1]->{'type'} eq 'empty_line'
and $current->{'contents'}->[-1]->{'text'} eq '') {
print STDERR "MENU STAR\n" if ($self->{'DEBUG'});
- _abort_empty_line ($self, $current);
+ _abort_empty_line($self, $current);
$line =~ s/^\*//;
push @{$current->{'contents'}}, { 'type' => 'menu_star',
'text' => '*' };
Modified: trunk/tp/Texinfo/Structuring.pm
===================================================================
--- trunk/tp/Texinfo/Structuring.pm 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/Texinfo/Structuring.pm 2013-02-28 08:07:53 UTC (rev 5212)
@@ -1985,13 +1985,14 @@
and $self->get_conf('INPUT_ENCODING_NAME')) {
$options->{'enabled_encoding'} = $self->get_conf('INPUT_ENCODING_NAME');
}
+ my %convert_text_options = Texinfo::Common::_convert_text_options($self);
+ $options = {%$options, %convert_text_options};
foreach my $index_name (keys(%$index_entries)) {
foreach my $entry (@{$index_entries->{$index_name}}) {
$entry->{'in_code'} =
$index_names->{$entry->{'index_name'}}->{'in_code'};
$options->{'code'} = $entry->{'in_code'};
$entry->{'key'} = Texinfo::Convert::Text::convert(
- {'contents' => $entry->{'content'}},
- {%$options, Texinfo::Common::_convert_text_options($self)});
+ {'contents' => $entry->{'content'}}, $options);
if ($entry->{'key'} !~ /\S/) {
$self->line_warn(sprintf($self->__("empty index key in
address@hidden"),
$entry->{'index_at_command'}),
Modified: trunk/tp/maintain/all_tests.sh
===================================================================
--- trunk/tp/maintain/all_tests.sh 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/maintain/all_tests.sh 2013-02-28 08:07:53 UTC (rev 5212)
@@ -33,7 +33,7 @@
done
for result in t/results/$test_name/*/res*/; do
out=`echo $result | sed 's;res\([^/]*/\)$;out\1;'`
- diff -a -u --exclude=CVS -r $result $out
+ diff -a -u --exclude=CVS --exclude=.svn -r $result $out
done
fi
else
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs.pl 2013-02-27
00:55:04 UTC (rev 5211)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs.pl 2013-02-28
08:07:53 UTC (rev 5212)
@@ -23277,15 +23277,6 @@
},
{
'file_name' => '',
- 'error_line' => ':89: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 89
- },
- {
- 'file_name' => '',
'error_line' => ':91: warning: could not find @image file `f--ile1.txt\'
nor alternate text
',
'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
@@ -23301,24 +23292,6 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 89
- },
- {
- 'file_name' => '',
- 'error_line' => ':89: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 89
- },
- {
- 'file_name' => '',
- 'error_line' => ':89: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 89
}
];
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
2013-02-28 08:07:53 UTC (rev 5212)
@@ -22286,15 +22286,6 @@
},
{
'file_name' => '',
- 'error_line' => ':92: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 92
- },
- {
- 'file_name' => '',
'error_line' => ':94: warning: could not find @image file `f--ile1.txt\'
nor alternate text
',
'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
@@ -22310,24 +22301,6 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 92
- },
- {
- 'file_name' => '',
- 'error_line' => ':92: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 92
- },
- {
- 'file_name' => '',
- 'error_line' => ':92: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 92
}
];
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
2013-02-28 08:07:53 UTC (rev 5212)
@@ -22286,15 +22286,6 @@
},
{
'file_name' => '',
- 'error_line' => ':92: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 92
- },
- {
- 'file_name' => '',
'error_line' => ':94: warning: could not find @image file `f--ile1.txt\'
nor alternate text
',
'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
@@ -22310,24 +22301,6 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 92
- },
- {
- 'file_name' => '',
- 'error_line' => ':92: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 92
- },
- {
- 'file_name' => '',
- 'error_line' => ':92: warning: could not find @image file `f--ile1.txt\'
nor alternate text
-',
- 'text' => 'could not find @image file `f--ile1.txt\' nor alternate text',
- 'type' => 'warning',
- 'macro' => '',
- 'line_nr' => 92
}
];
Modified: trunk/tp/t/results/test_count/printindex.pl
===================================================================
--- trunk/tp/t/results/test_count/printindex.pl 2013-02-27 00:55:04 UTC (rev
5211)
+++ trunk/tp/t/results/test_count/printindex.pl 2013-02-28 08:07:53 UTC (rev
5212)
@@ -581,14 +581,14 @@
[2] (0,0) :text_root
[2] (0,0)
[3] (0,0) @node
- [4] (17,0) :_code
- [5] (17,0) :text|Top|
- [5] (17,0)
- locations (1) l 0 b 0
- [4] (17,0)
+ [4] (0,0) :_code
+ [5] (0,0) :text|Top|
+ [5] (0,0)
+ [4] (0,0)
[6] (27,0) :_code
[7] (27,0) :text|(|
[7] (27,0)
+ locations (1) l 0 b 0
[8] (27,0) :text|dir|
[8] (27,0)
[9] (27,0) :text|)|
@@ -612,83 +612,51 @@
[17] (55,6) :text|after index|
[17] (60,6)
[16] (60,6)
- [18] (96,6) :_code
- [19] (96,6) :text|Top|
- [19] (96,6)
- [18] (96,6)
- [20] (128,7) :frenchspacing
- [21] (128,7) :text|index entry|
- [21] (133,7)
- [20] (133,7)
- [22] (169,7) :_code
- [23] (169,7) :text|Top|
- [23] (169,7)
- [22] (169,7)
- [24] (201,8) :frenchspacing
- [25] (201,8) :text|index entry|
- [25] (206,8)
- [24] (206,8)
- [26] (242,8) :_code
- [27] (242,8) :text|Top|
- [27] (242,8)
- [26] (242,8)
- [28] (274,9) :frenchspacing
- [29] (274,9)
:text|looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong index
entry|
- [29] (342,9)
- [28] (342,9)
- [30] (352,9) :_code
- [31] (352,9) :text|Top|
- [31] (352,9)
- [30] (352,9)
+ [18] (128,7) :frenchspacing
+ [19] (128,7) :text|index entry|
+ [19] (133,7)
+ [18] (133,7)
+ [20] (201,8) :frenchspacing
+ [21] (201,8) :text|index entry|
+ [21] (206,8)
+ [20] (206,8)
+ [22] (274,9) :frenchspacing
+ [23] (274,9)
:text|looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong index
entry|
+ [23] (342,9)
+ [22] (342,9)
[15] (431,12)
- [32] (431,12) :empty_line:text|\\n|
- [32] (431,12)
- [33] (431,12) @cindex:index_entry_command
- [33] (431,12)
+ [24] (431,12) :empty_line:text|\\n|
+ [24] (431,12)
+ [25] (431,12) @cindex:index_entry_command
+ [25] (431,12)
locations (5) l 12
- [34] (431,12) :empty_line:text|\\n|
- [34] (431,12)
- [35] (431,12) @printindex
- [36] (452,15) :frenchspacing
- [37] (452,15) :text|after index|
- [37] (457,15)
- [36] (457,15)
- [38] (493,15) :_code
- [39] (493,15) :text|Top|
- [39] (493,15)
- [38] (493,15)
- [40] (525,16) :frenchspacing
- [41] (525,16) :text|index entry|
- [41] (530,16)
- [40] (530,16)
- [42] (566,16) :_code
- [43] (566,16) :text|Top|
- [43] (566,16)
- [42] (566,16)
- [44] (598,17) :frenchspacing
- [45] (598,17) :text|index entry|
- [45] (603,17)
- [44] (603,17)
- [46] (639,17) :_code
- [47] (639,17) :text|Top|
- [47] (639,17)
- [46] (639,17)
- [48] (671,18) :frenchspacing
- [49] (671,18)
:text|looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong index
entry|
- [49] (739,18)
- [48] (739,18)
- [50] (749,18) :_code
- [51] (749,18) :text|Top|
- [51] (749,18)
- [50] (749,18)
- [35] (828,21)
- [52] (828,21) :empty_line:text|\\n|
- [52] (828,21)
- [53] (828,21) @anchor
- [53] (828,21)
+ [26] (431,12) :empty_line:text|\\n|
+ [26] (431,12)
+ [27] (431,12) @printindex
+ [28] (452,15) :frenchspacing
+ [29] (452,15) :text|after index|
+ [29] (457,15)
+ [28] (457,15)
+ [30] (525,16) :frenchspacing
+ [31] (525,16) :text|index entry|
+ [31] (530,16)
+ [30] (530,16)
+ [32] (598,17) :frenchspacing
+ [33] (598,17) :text|index entry|
+ [33] (603,17)
+ [32] (603,17)
+ [34] (671,18) :frenchspacing
+ [35] (671,18)
:text|looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong index
entry|
+ [35] (739,18)
+ [34] (739,18)
+ [27] (828,21)
+ [36] (828,21) :empty_line:text|\\n|
+ [36] (828,21)
+ [37] (828,21) @anchor
+ [37] (828,21)
locations (6) l 21 b 828
- [54] (828,21) :empty_spaces_after_close_brace:text|\\n|
- [54] (828,21)
+ [38] (828,21) :empty_spaces_after_close_brace:text|\\n|
+ [38] (828,21)
[3] (828,21)
[1] (828,21)
Modified: trunk/tp/t/test_utils.pl
===================================================================
--- trunk/tp/t/test_utils.pl 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/t/test_utils.pl 2013-02-28 08:07:53 UTC (rev 5212)
@@ -243,8 +243,9 @@
}
foreach my $file (sort(keys(%dir1_files))) {
if ($dir2_files{$file}) {
- if (compare("$dir1/$file", "$dir2/$file")) {
- push @errors, "$dir1/$file and $dir2/$file differ";
+ my $status = compare("$dir1/$file", "$dir2/$file");
+ if ($status) {
+ push @errors, "$dir1/$file and $dir2/$file differ: $status";
}
delete $dir2_files{$file};
} else {
@@ -438,6 +439,21 @@
return $converter_options;
}
+sub close_files($)
+{
+ my $converter = shift;
+ my $converter_unclosed_files = $converter->converter_unclosed_files();
+ if ($converter_unclosed_files) {
+ foreach my $unclosed_file (keys(%$converter_unclosed_files)) {
+ if (!close($converter_unclosed_files->{$unclosed_file})) {
+ # FIXME or die?
+ warn(sprintf("tp_utils.pl: error on closing %s: %s\n",
+ $converter_unclosed_files->{$unclosed_file}, $!));
+ }
+ }
+ }
+}
+
sub convert_to_plaintext($$$$$$;$)
{
my $self = shift;
@@ -466,6 +482,7 @@
$result = $converter->convert($tree);
} else {
$result = $converter->output($tree);
+ close_files($converter);
$result = undef if (defined($result and $result eq ''));
}
my ($errors, $error_nrs) = $converter->errors();
@@ -492,6 +509,7 @@
'output_format' => 'info',
%$converter_options });
my $result = $converter->output($tree);
+ close_files($converter);
die if (!defined($converter_options->{'SUBDIR'}) and !defined($result));
my ($errors, $error_nrs) = $converter->errors();
return ($errors, $result);
@@ -528,6 +546,7 @@
$result = $converter->convert($tree);
} else {
$result = $converter->output($tree);
+ close_files($converter);
}
die if (!defined($converter_options->{'SUBDIR'}) and !defined($result));
my ($errors, $error_nrs) = $converter->errors();
@@ -559,6 +578,7 @@
$result = $converter->convert($tree);
} else {
$result = $converter->output($tree);
+ close_files($converter);
$result = undef if (defined($result and $result eq ''));
}
my ($errors, $error_nrs) = $converter->errors();
@@ -589,6 +609,7 @@
$result = $converter->convert($tree);
} else {
$result = $converter->output($tree);
+ close_files($converter);
$result = undef if (defined($result and $result eq ''));
}
my ($errors, $error_nrs) = $converter->errors();
Modified: trunk/tp/texi2any.pl
===================================================================
--- trunk/tp/texi2any.pl 2013-02-27 00:55:04 UTC (rev 5211)
+++ trunk/tp/texi2any.pl 2013-02-28 08:07:53 UTC (rev 5212)
@@ -1189,9 +1189,9 @@
$macro_expand_file, $parser->{'INPUT_PERL_ENCODING'});
my $error_macro_expand_file;
- if (defined ($macro_expand_fh)) {
+ if (defined($macro_expand_fh)) {
print $macro_expand_fh $texinfo_text;
- if (!close ($macro_expand_fh)) {
+ if (!close($macro_expand_fh)) {
document_warn(sprintf(__("error on closing macro expand file %s:
%s\n"),
$macro_expand_file, $!));
$error_macro_expand_file = 1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5212] * tp/t/test_utils.pl: close generated files before doing the comparison.,
Patrice Dumas <=