[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (%index_names), tp/t/test_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (%index_names), tp/t/test_utils.pl (test): complete the %index_names structure to have the 'contained_indices' field and use it as a reference in tests for the default index names structure. |
Date: |
Sun, 05 Sep 2021 15:53:36 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 55e1b7c * tp/Texinfo/Common.pm (%index_names), tp/t/test_utils.pl
(test): complete the %index_names structure to have the 'contained_indices'
field and use it as a reference in tests for the default index names structure.
55e1b7c is described below
commit 55e1b7cc414564a0cfb17c3f0ea76f1174ab9789
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 5 21:53:25 2021 +0200
* tp/Texinfo/Common.pm (%index_names), tp/t/test_utils.pl (test):
complete the %index_names structure to have the 'contained_indices'
field and use it as a reference in tests for the default index
names structure.
* tp/Texinfo/Common.pm (copy_options_for_convert_text)
(copy_contents), tp/Texinfo/Structuring.pm (print_element_directions)
(index_entry_sort_string, get_node_node_childs_from_sectioning),
tp/t/test_utils.pl (unsplit), tp/Texinfo/Transformations.pm,
tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/Convert/TexinfoXML.pm, tp/Texinfo/Convert/Text.pm,
tp/Texinfo/Convert/TextContent.pm:
rename Texinfo::Common _convert_text_options() as
copy_options_for_convert_text().
Add _copy_contents as copy_contents() in Texinfo::Common,
from Texinfo::Structuring.
Rename Texinfo::Structuring _print_directions() as
print_element_directions().
Rename Texinfo::Structuring get_node_node_childs() as
get_node_node_childs_from_sectioning().
Rename Texinfo::Structuring index_key() as index_entry_sort_string().
Move Texinfo::Structuring _unsplit() to tp/t/test_utils.pl, renamed
as unsplit().
Remove _sort_index_entries_in_letter() it is not used anymore,
the same function is used for sorting when sorting by letter
or not.
---
ChangeLog | 30 +++
tp/Texinfo/Common.pm | 28 ++-
tp/Texinfo/Convert/DocBook.pm | 55 +++--
tp/Texinfo/Convert/HTML.pm | 16 +-
tp/Texinfo/Convert/IXIN.pm | 4 +-
tp/Texinfo/Convert/Info.pm | 6 +-
tp/Texinfo/Convert/LaTeX.pm | 24 +-
tp/Texinfo/Convert/Plaintext.pm | 2 +-
tp/Texinfo/Convert/TexinfoXML.pm | 7 +-
tp/Texinfo/Convert/Text.pm | 2 +-
tp/Texinfo/Convert/TextContent.pm | 2 +-
tp/Texinfo/Structuring.pm | 456 +++++++++++++++++++-------------------
tp/Texinfo/Transformations.pm | 14 +-
tp/init/chm.pm | 2 +-
tp/init/highlight_syntax.pm | 2 +-
tp/t/test_utils.pl | 23 +-
16 files changed, 370 insertions(+), 303 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8afad52..b5d8a0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,35 @@
2021-09-05 Patrice Dumas <pertusus@free.fr>
+ * tp/Texinfo/Common.pm (%index_names), tp/t/test_utils.pl (test):
+ complete the %index_names structure to have the 'contained_indices'
+ field and use it as a reference in tests for the default index
+ names structure.
+
+ * tp/Texinfo/Common.pm (copy_options_for_convert_text)
+ (copy_contents), tp/Texinfo/Structuring.pm (print_element_directions)
+ (index_entry_sort_string, get_node_node_childs_from_sectioning),
+ tp/t/test_utils.pl (unsplit), tp/Texinfo/Transformations.pm,
+ tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm,
+ tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
+ tp/Texinfo/Convert/TexinfoXML.pm, tp/Texinfo/Convert/Text.pm,
+ tp/Texinfo/Convert/TextContent.pm:
+ rename Texinfo::Common _convert_text_options() as
+ copy_options_for_convert_text().
+ Add _copy_contents as copy_contents() in Texinfo::Common,
+ from Texinfo::Structuring.
+ Rename Texinfo::Structuring _print_directions() as
+ print_element_directions().
+ Rename Texinfo::Structuring get_node_node_childs() as
+ get_node_node_childs_from_sectioning().
+ Rename Texinfo::Structuring index_key() as index_entry_sort_string().
+ Move Texinfo::Structuring _unsplit() to tp/t/test_utils.pl, renamed
+ as unsplit().
+ Remove _sort_index_entries_in_letter() it is not used anymore,
+ the same function is used for sorting when sorting by letter
+ or not.
+
+2021-09-05 Patrice Dumas <pertusus@free.fr>
+
* tp/Texinfo/Translations.pm (gdt, complete_indices),
tp/Texinfo/Convert/Text.pm: pass optionally the language to gdt().
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index e1a19d0..3b31528 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -627,8 +627,9 @@ our %index_names = (
'tp' => {'in_code' => 1},
);
-foreach my $index(keys(%index_names)) {
+foreach my $index (keys(%index_names)) {
$index_names{$index}->{'name'} = $index;
+ $index_names{$index}->{'contained_indices'}->{$index} = 1;
}
our %default_index_commands;
@@ -1556,15 +1557,16 @@ sub normalize_top_node_name($)
return $node;
}
-# Argument is typically a converter object
-sub _convert_text_options($)
+# $SELF is typically a converter object.
+# Setup options as used by Texinfo::Convert::Text::convert_to_text
+# based on the converter informations.
+sub copy_options_for_convert_text($)
{
my $self = shift;
my %options;
- if ($self->get_conf('ENABLE_ENCODING')) {
- if ($self->get_conf('OUTPUT_ENCODING_NAME')) {
- $options{'enabled_encoding'} = $self->get_conf('OUTPUT_ENCODING_NAME');
- }
+ if ($self->get_conf('ENABLE_ENCODING')
+ and $self->get_conf('OUTPUT_ENCODING_NAME')) {
+ $options{'enabled_encoding'} = $self->get_conf('OUTPUT_ENCODING_NAME');
}
$options{'TEST'} = 1 if ($self->get_conf('TEST'));
$options{'NUMBER_SECTIONS'} = $self->get_conf('NUMBER_SECTIONS');
@@ -1913,6 +1915,18 @@ sub copy_tree($;$)
return $copy;
}
+sub copy_contents($)
+{
+ my $contents = shift;
+ if (ref($contents) ne 'ARRAY') {
+ cluck "$contents not an array";
+ return undef;
+ }
+ my $copy = copy_tree({'contents' => $contents});
+ return $copy->{'contents'};
+}
+
+
sub modify_tree($$;$);
sub modify_tree($$;$)
{
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index d16cdaa..6ad798a 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -839,11 +839,13 @@ sub _convert($$;$)
if ($root->{'cmdname'} eq 'inforef') {
my $filename;
if (scalar(@{$root->{'args'}}) == 3
- and defined($root->{'args'}->[-1]) and
@{$root->{'args'}->[-1]->{'contents'}}) {
- $filename
- =
$self->xml_protect_text(Texinfo::Convert::Text::convert_to_text(
- {'contents' => $root->{'args'}->[-1]->{'contents'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)}));
+ and defined($root->{'args'}->[-1])
+ and @{$root->{'args'}->[-1]->{'contents'}}) {
+ $filename =
+
$self->xml_protect_text(Texinfo::Convert::Text::convert_to_text(
+ {'contents' => $root->{'args'}->[-1]->{'contents'}},
+ {'code' => 1,
+ Texinfo::Common::copy_options_for_convert_text($self)}));
}
my $node;
if (defined($root->{'args'}->[0]) and
@{$root->{'args'}->[0]->{'contents'}}) {
@@ -976,10 +978,11 @@ sub _convert($$;$)
return '';
}
} elsif ($root->{'cmdname'} eq 'image') {
- if (defined($root->{'args'}->[0]) and
@{$root->{'args'}->[0]->{'contents'}}) {
+ if (defined($root->{'args'}->[0])
+ and @{$root->{'args'}->[0]->{'contents'}}) {
my $basefile = Texinfo::Convert::Text::convert_to_text(
{'contents' => $root->{'args'}->[0]->{'contents'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ {'code' => 1,
Texinfo::Common::copy_options_for_convert_text($self)});
my $element;
my $is_inline = $self->_is_inline($root);
if ($is_inline) {
@@ -1026,16 +1029,17 @@ sub _convert($$;$)
my $email;
my $email_text;
if (scalar(@{$root->{'args'}}) == 2
- and defined($root->{'args'}->[-1]) and
@{$root->{'args'}->[-1]->{'contents'}}) {
+ and defined($root->{'args'}->[-1])
+ and @{$root->{'args'}->[-1]->{'contents'}}) {
$name = $root->{'args'}->[1]->{'contents'};
}
if (defined($root->{'args'}->[0]) and
@{$root->{'args'}->[0]->{'contents'}}) {
$email = $root->{'args'}->[0]->{'contents'};
- $email_text
+ $email_text
= $self->_protect_text(Texinfo::Convert::Text::convert_to_text(
- {'contents' => $email},
- {'code' => 1,
-
Texinfo::Common::_convert_text_options($self)}));
+ {'contents' => $email},
+ {'code' => 1,
+
Texinfo::Common::copy_options_for_convert_text($self)}));
}
if ($name and $email) {
return "<ulink url=\"mailto:$email_text\">"
@@ -1052,12 +1056,14 @@ sub _convert($$;$)
} elsif ($root->{'cmdname'} eq 'uref' or $root->{'cmdname'} eq 'url') {
if ($root->{'args'}) {
my ($url_text, $url_content);
- if (defined($root->{'args'}->[0]) and
@{$root->{'args'}->[0]->{'contents'}}) {
+ if (defined($root->{'args'}->[0])
+ and @{$root->{'args'}->[0]->{'contents'}}) {
$url_content = $root->{'args'}->[0]->{'contents'};
- $url_text =
$self->_protect_text(Texinfo::Convert::Text::convert_to_text(
- {'contents' => $url_content},
- {'code' => 1,
-
Texinfo::Common::_convert_text_options($self)}));
+ $url_text = $self->_protect_text(
+ Texinfo::Convert::Text::convert_to_text(
+ {'contents' => $url_content},
+ {'code' => 1,
+
Texinfo::Common::copy_options_for_convert_text($self)}));
} else {
$url_text = '';
}
@@ -1230,8 +1236,8 @@ sub _convert($$;$)
foreach my $prototype (@{$root->{'extra'}->{'prototypes'}}) {
my $prototype_text
= Texinfo::Convert::Text::convert_to_text($prototype,
-
{Texinfo::Common::_convert_text_options($self)});
- push @fractions,
+ {Texinfo::Common::copy_options_for_convert_text($self)});
+ push @fractions,
Texinfo::Convert::Unicode::string_width($prototype_text);
}
} elsif ($root->{'extra'}->{'columnfractions'}) {
@@ -1271,13 +1277,14 @@ sub _convert($$;$)
if ($root->{'args'} and $root->{'args'}->[0]
and $root->{'args'}->[0]->{'contents'}
and @{$root->{'args'}->[0]->{'contents'}}) {
- my $quotation_arg_text = Texinfo::Convert::Text::convert_to_text(
- $root->{'args'}->[0],
- {Texinfo::Common::_convert_text_options($self)});
+ my $quotation_arg_text
+ = Texinfo::Convert::Text::convert_to_text(
+ $root->{'args'}->[0],
+ {Texinfo::Common::copy_options_for_convert_text($self)});
if ($docbook_special_quotations{lc($quotation_arg_text)}) {
$element = lc($quotation_arg_text);
} else {
- $self->{'pending_prepend'}
+ $self->{'pending_prepend'}
= $self->_convert($self->gdt('@b{{quotation_arg}:} ',
{'quotation_arg' =>
$root->{'args'}->[0]->{'contents'}}));
@@ -1311,7 +1318,7 @@ sub _convert($$;$)
if ($root->{'type'}) {
- #warn " have type $root->{'type'}\n";
+ #warn " have type $root->{'type'}\n";
if (exists($docbook_preformatted_formats{$root->{'type'}})) {
push @{$self->{'document_context'}->[-1]->{'preformatted_stack'}},
$docbook_preformatted_formats{$root->{'type'}};
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 9d8af02..cb85d73 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -4347,7 +4347,7 @@ sub _convert_def_line_type($$$$)
if ($self->in_string()) {
return $self->protect_text(Texinfo::Convert::Text::convert_to_text(
- $command, Texinfo::Common::_convert_text_options($self)));
+ $command, Texinfo::Common::copy_options_for_convert_text($self)));
}
my $index_label = '';
@@ -6216,7 +6216,7 @@ sub _external_node_href($$$$)
my $manual_name = Texinfo::Convert::Text::convert_to_text(
{'contents' => $external_node->{'manual_content'}},
{ 'code' => 1,
- Texinfo::Common::_convert_text_options($self)});
+ Texinfo::Common::copy_options_for_convert_text($self)});
my $manual_base = $manual_name;
$manual_base =~ s/\.info*$//;
$manual_base =~ s/^.*\///;
@@ -6377,8 +6377,8 @@ sub _element_direction($$$$;$)
######## debug
if (!$element_target->{'type'}) {
die "No type for element_target $direction $element_target: "
- . Texinfo::Common::_print_current_keys($element_target)
- . "directions :". Texinfo::Structuring::_print_directions($element);
+ . Texinfo::Common::_print_current_keys($element_target)
+ . "directions :".
Texinfo::Structuring::print_element_directions($element);
}
########
if ($element_target->{'type'} eq 'external_node') {
@@ -7241,7 +7241,7 @@ sub output_internal_links($)
my $tree = $self->command_text($command, 'tree');
if ($tree) {
$text = Texinfo::Convert::Text::convert_to_text($tree,
- {Texinfo::Common::_convert_text_options($self)});
+ {Texinfo::Common::copy_options_for_convert_text($self)});
}
}
if (defined($href) or defined($text)) {
@@ -7253,7 +7253,7 @@ sub output_internal_links($)
}
}
if ($self->{'parser'}) {
- my %options = Texinfo::Common::_convert_text_options($self);
+ my %options = Texinfo::Common::copy_options_for_convert_text($self);
foreach my $index_name (sort(keys
(%{$self->{'index_entries_by_letter'}}))) {
foreach my $letter_entry
(@{$self->{'index_entries_by_letter'}->{$index_name}}) {
foreach my $index_entry (@{$letter_entry->{'entries'}}) {
@@ -7464,7 +7464,7 @@ sub output($$)
if ($self->{'extra'}->{'copying'}) {
my $copying_comment = Texinfo::Convert::Text::convert_to_text(
{'contents' => $self->{'extra'}->{'copying'}->{'contents'}},
- {Texinfo::Common::_convert_text_options($self)});
+ {Texinfo::Common::copy_options_for_convert_text($self)});
if ($copying_comment ne '') {
$self->{'copying_comment'} = &{$self->{'format_comment'}}($self,
$copying_comment);
}
@@ -8042,7 +8042,7 @@ sub _convert($$;$)
} elsif ($arg_type eq 'monospacetext') {
$arg_formatted->{$arg_type}
= Texinfo::Convert::Text::convert_to_text($arg, {'code' => 1,
- Texinfo::Common::_convert_text_options($self)});
+
Texinfo::Common::copy_options_for_convert_text($self)});
} elsif ($arg_type eq 'raw') {
$self->{'document_context'}->[-1]->{'raw'}++;
$arg_formatted->{$arg_type} = $self->_convert($arg,
$explanation);
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 87b6e42..026ebb5 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -828,13 +828,13 @@ sub output_ixin($$)
and @{$command->{'args'}->[0]->{'contents'}}) {
$basefile = Texinfo::Convert::Text::convert_to_text(
{'contents' => $command->{'args'}->[0]->{'contents'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ {'code' => 1,
Texinfo::Common::copy_options_for_convert_text($self)});
}
if (defined($command->{'args'}->[4])
and @{$command->{'args'}->[4]->{'contents'}}) {
$extension = Texinfo::Convert::Text::convert_to_text(
{'contents' => $command->{'args'}->[4]->{'contents'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ {'code' => 1,
Texinfo::Common::copy_options_for_convert_text($self)});
$extension =~ s/^\.//;
@extension = ($extension);
}
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index da952c8..43f8299 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -487,12 +487,12 @@ sub _image($$)
and @{$root->{'args'}->[0]->{'contents'}}) {
my $basefile = Texinfo::Convert::Text::convert_to_text(
{'contents' => $root->{'args'}->[0]->{'contents'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ {'code' => 1, Texinfo::Common::copy_options_for_convert_text($self)});
if (defined($root->{'args'}->[4])
and @{$root->{'args'}->[4]->{'contents'}}) {
my $extension = Texinfo::Convert::Text::convert_to_text(
{'contents' => $root->{'args'}->[4]->{'contents'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ {'code' => 1, Texinfo::Common::copy_options_for_convert_text($self)});
unshift @extensions, ".$extension";
unshift @extensions, "$extension";
}
@@ -511,7 +511,7 @@ sub _image($$)
and @{$root->{'args'}->[3]->{'contents'}}) {
$alt = Texinfo::Convert::Text::convert_to_text(
{'contents' => $root->{'args'}->[3]->{'contents'}},
- {Texinfo::Common::_convert_text_options($self)});
+ {Texinfo::Common::copy_options_for_convert_text($self)});
}
my $result;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index d175995..4a89291 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -694,7 +694,7 @@ sub converter_initialize($)
%{$self->{'quotes_map'}} = %quotes_map;
$self->{'convert_text_options'}
- = {Texinfo::Common::_convert_text_options($self)};
+ = {Texinfo::Common::copy_options_for_convert_text($self)};
# this condition means that there is no way to turn off
# @U expansion to utf-8 characters even though this
@@ -1625,15 +1625,15 @@ sub _index_entry($$)
if ($in_code) {
$self->{'formatting_context'}->[-1]->{'code'} -= 1;
# always setup a string to sort with code as we use a command
- $sortas = Texinfo::Structuring::index_key($entry, $subentry,
- $subentry_sortas, $options, $ignore_chars);
+ $sortas = Texinfo::Structuring::index_entry_sort_string($entry,
+ $subentry, $subentry_sortas, $options, $ignore_chars);
} else {
if (defined($subentry_sortas)) {
$sortas = $subentry_sortas;
} elsif (defined($ignore_chars) and $ignore_chars ne '') {
# setup a sort string if some characters are ignored
- $sortas = Texinfo::Structuring::index_key($entry, $subentry,
- $subentry_sortas, $options, $ignore_chars);
+ $sortas = Texinfo::Structuring::index_entry_sort_string($entry,
+ $subentry, $subentry_sortas, $options, $ignore_chars);
}
}
my $result = '';
@@ -1993,9 +1993,9 @@ sub _convert($$)
$email = $root->{'args'}->[0]->{'contents'};
$email_text
= $self->_protect_url(Texinfo::Convert::Text::convert_to_text(
- {'contents' => $email},
- {'code' => 1,
-
Texinfo::Common::_convert_text_options($self)}));
+ {'contents' => $email},
+ {'code' => 1,
+
Texinfo::Common::copy_options_for_convert_text($self)}));
}
if ($name and $email) {
$result .= "\\href{mailto:$email_text}{$converted_name}";
@@ -2016,10 +2016,10 @@ sub _convert($$)
} elsif (@{$root->{'args'}->[0]->{'contents'}}) {
my $url_content = $root->{'args'}->[0]->{'contents'};
my $url_text = $self->_protect_url(
- Texinfo::Convert::Text::convert_to_text(
- {'contents' => $url_content},
- {'code' => 1,
-
Texinfo::Common::_convert_text_options($self)}));
+ Texinfo::Convert::Text::convert_to_text(
+ {'contents' => $url_content},
+ {'code' => 1,
+ Texinfo::Common::copy_options_for_convert_text($self)}));
if (scalar(@{$root->{'args'}}) == 2
and defined($root->{'args'}->[1])
and @{$root->{'args'}->[1]->{'contents'}}) {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index a773b6b..d56d393 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -396,7 +396,7 @@ sub converter_initialize($)
%{$self->{'style_map'}} = %style_map;
$self->{'convert_text_options'}
- = {Texinfo::Common::_convert_text_options($self)};
+ = {Texinfo::Common::copy_options_for_convert_text($self)};
if ($self->get_conf('ENABLE_ENCODING') and
$self->get_conf('OUTPUT_ENCODING_NAME')
and $self->get_conf('OUTPUT_ENCODING_NAME') eq 'utf-8') {
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index 6692ffa..926f832 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -1233,13 +1233,14 @@ sub _convert($$;$)
$manual = Texinfo::Convert::Text::convert_to_text({'contents'
=> $root->{'args'}->[$manual_arg_index]->{'contents'}},
{'code' => 1,
- Texinfo::Common::_convert_text_options($self)});
+ Texinfo::Common::copy_options_for_convert_text($self)});
}
if (!defined($manual) and $root->{'extra'}->{'node_argument'}
and $root->{'extra'}->{'node_argument'}->{'manual_content'}) {
$manual = Texinfo::Convert::Text::convert_to_text({'contents'
- => $root->{'extra'}->{'node_argument'}->{'manual_content'}},
- {'code' => 1, Texinfo::Common::_convert_text_options($self)});
+ => $root->{'extra'}->{'node_argument'}->{'manual_content'}},
+ {'code' => 1,
+ Texinfo::Common::copy_options_for_convert_text($self)});
}
if (defined($manual)) {
my $manual_base = $manual;
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index cde2deb..f6159aa 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -721,7 +721,7 @@ sub output($$)
$outfile);
return undef if (!$fh);
}
- my %options = $self->Texinfo::Common::_convert_text_options();
+ my %options = Texinfo::Common::copy_options_for_convert_text($self);
my $result = _convert($tree, \%options);
if ($fh) {
print $fh $result;
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 2010467..121732e 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -129,7 +129,7 @@ sub _convert($$)
} elsif
(defined($Texinfo::Convert::Text::text_brace_no_arg_commands{$root->{'cmdname'}}))
{
return Texinfo::Convert::Text::brace_no_arg_command($root, undef);
} elsif ($Texinfo::Common::accent_commands{$root->{'cmdname'}}) {
- my %options = Texinfo::Common::_convert_text_options($self);
+ my %options = Texinfo::Common::copy_options_for_convert_text($self);
my $result = Texinfo::Convert::Text::text_accents ($root,
$options{'enabled_encoding'});
return $result;
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index fe04ea9..4c5a616 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -92,7 +92,7 @@ $unnumbered_commands{'part'} = 1;
my $min_level = $command_structuring_level{'chapter'};
my $max_level = $command_structuring_level{'subsubsection'};
-# Return numbered level of an element
+# Return numbered level of an element, as modified by raise/lowersections
sub section_level($)
{
my $section = shift;
@@ -1149,7 +1149,7 @@ sub elements_directions($$$)
if ($configuration_informations->get_conf('DEBUG')) {
foreach my $element (@$elements) {
print STDERR "Directions($element): "
- .Texinfo::Structuring::_print_directions($element)."\n";
+ . print_element_directions($element)."\n";
}
}
}
@@ -1213,7 +1213,7 @@ sub elements_file_directions($)
}
my %sectioning_commands = %Texinfo::Common::sectioning_commands;
-# for debugging
+# for debugging. Used in other modules.
sub _print_root_command_texi($)
{
my $command = shift;
@@ -1233,7 +1233,7 @@ sub _print_root_command_texi($)
return 'UNDEF @'.$command->{'cmdname'};
}
-# for debugging
+# for debugging. Used in other modules.
sub _print_element_command_texi($)
{
my $element = shift;
@@ -1265,8 +1265,10 @@ sub _print_element_command_texi($)
return _print_root_command_texi($command);
}
-# for debugging
-sub _print_directions($)
+# Used for debugging and in test suite, but not generally useful. Not
+# documented in pod section and not exportable as it should not, in
+# general, be used.
+sub print_element_directions($)
{
my $element = shift;
my $result = 'element: '._print_element_command_texi($element)."\n";
@@ -1282,20 +1284,6 @@ sub _print_directions($)
return $result;
}
-# this is used in the test suite, but not likely to be useful in real life.
-sub _unsplit($)
-{
- my $root = shift;
- if (!$root->{'type'} or $root->{'type'} ne 'document_root'
- or !$root->{'contents'}) {
- return $root;
- }
- foreach my $content (@{$root->{'contents'}}) {
- $content->{'parent'} = $root;
- }
- return $root;
-}
-
# For each internal reference command, set the 'label' key in the 'extra'
# hash of the reference tree element to the associated labeled tree element.
sub associate_internal_references($$$$$)
@@ -1384,18 +1372,7 @@ sub number_floats($)
}
}
-sub _copy_contents($)
-{
- my $contents = shift;
- if (ref($contents) ne 'ARRAY') {
- cluck "$contents not an array";
- return undef;
- }
- my $copy = Texinfo::Common::copy_tree({'contents' => $contents});
- return $copy->{'contents'};
-}
-
-sub get_node_node_childs
+sub get_node_node_childs_from_sectioning
{
my ($node) = @_;
@@ -1431,6 +1408,8 @@ sub get_node_node_childs
return @node_childs;
}
+# returns the texinfo tree corresponding to a single menu entry pointing to
$NODE.
+# if $USE_SECTIONS is set, use the section name instead of node name.
sub new_node_menu_entry
{
my ($node, $use_sections) = @_;
@@ -1450,7 +1429,8 @@ sub new_node_menu_entry
if ($use_sections) {
$menu_entry_name = {'type' => 'menu_entry_name'};
- $menu_entry_name->{'contents'} = _copy_contents ($name_contents);
+ $menu_entry_name->{'contents'}
+ = Texinfo::Common::copy_contents($name_contents);
foreach my $content (@{$menu_entry_name->{'contents'}}) {
$content->{'parent'} = $menu_entry_name;
}
@@ -1458,7 +1438,7 @@ sub new_node_menu_entry
my $menu_entry_node = {'type' => 'menu_entry_node'};
$menu_entry_node->{'contents'}
- = _copy_contents ($node_contents);
+ = Texinfo::Common::copy_contents($node_contents);
foreach my $content (@{$menu_entry_node->{'contents'}}) {
$content->{'parent'} = $menu_entry_node;
@@ -1537,7 +1517,7 @@ sub new_complete_node_menu
{
my ($node, $use_sections) = @_;
- my @node_childs = get_node_node_childs($node);
+ my @node_childs = get_node_node_childs_from_sectioning($node);
if (not scalar(@node_childs)) {
return;
@@ -1550,9 +1530,9 @@ sub new_complete_node_menu
}
my $section = $node->{'extra'}->{'associated_section'};
- my $current_menu = new_block_command (\@pending, $section, 'menu');
+ my $new_menu = new_block_command (\@pending, $section, 'menu');
- return $current_menu;
+ return $new_menu;
}
sub _sort_string($$)
@@ -1575,8 +1555,8 @@ sub _sort_index_entries($$)
if ($res == 0) {
$res = ($key1->{'number'} <=> $key2->{'number'});
}
- # This may happen if 2 indices are merged as the number is per
- # index name. The @-command should be different though, for
+ # This may happen if 2 indices are merged as the number is per
+ # index name. The @-command should be different though, for
# index names to be different.
if ($res == 0) {
$res = ($key1->{'index_at_command'} cmp $key2->{'index_at_command'});
@@ -1584,22 +1564,6 @@ sub _sort_index_entries($$)
return $res;
}
-sub _sort_index_entries_in_letter($$)
-{
- my $key1 = shift;
- my $key2 = shift;
- my $a = uc($key1->{'key'});
- my $b = uc($key2->{'key'});
- my $res = ($a cmp $b);
- if ($res == 0) {
- $res = ($key1->{'number'} <=> $key2->{'number'});
- }
- if ($res == 0) {
- $res = ($key1->{'index_at_command'} cmp $key2->{'index_at_command'});
- }
- return $res;
-}
-
sub setup_index_entry_keys_formatting($$)
{
my $self = shift;
@@ -1618,13 +1582,13 @@ sub setup_index_entry_keys_formatting($$)
if defined $self->{'values'}->{'txiindexatsignignore'};
my $options = {'sort_string' => 1,
-
Texinfo::Common::_convert_text_options($configuration_informations)};
+
Texinfo::Common::copy_options_for_convert_text($configuration_informations)};
return $options, $ignore_chars;
}
# can be used for subentries
-sub index_key($$$$;$)
+sub index_entry_sort_string($$$$;$)
{
my $main_entry = shift;
my $entry_tree_element = shift;
@@ -1654,6 +1618,8 @@ sub index_key($$$$;$)
return $entry_key;
}
+# the structure returned depends on $SORT_BY_LETTER being set
+# or not. It is described in the pod documentation.
sub sort_indices($$$$;$)
{
my $self = shift;
@@ -1672,7 +1638,8 @@ sub sort_indices($$$$;$)
# used if $sort_by_letter
my $index_letter_hash;
foreach my $entry (@{$index_entries->{$index_name}}) {
- my $entry_key = index_key($entry, {'contents' => $entry->{'content'}},
+ my $entry_key = index_entry_sort_string($entry,
+ {'contents' => $entry->{'content'}},
$entry->{'sortas'}, $options, $ignore_chars);
$index_entries_sort_strings->{$entry} = $entry_key;
if ($entry_key !~ /\S/) {
@@ -1697,7 +1664,7 @@ sub sort_indices($$$$;$)
foreach my $letter (sort _sort_string (keys %$index_letter_hash)) {
my @sorted_letter_entries
= map {$_->{'entry'}}
- sort _sort_index_entries_in_letter
@{$index_letter_hash->{$letter}};
+ sort _sort_index_entries @{$index_letter_hash->{$letter}};
push @{$sorted_index_entries->{$index_name}},
{ 'letter' => $letter, 'entries' => \@sorted_letter_entries };
}
@@ -1733,10 +1700,6 @@ sub merge_indices($)
__END__
-#Last,
-#C<output_internal_links> may be used to output element and
-#index entries references, mostly for HTML output.
-
=head1 NAME
Texinfo::Structuring - information on Texinfo::Parser tree
@@ -1745,22 +1708,23 @@ Texinfo::Structuring - information on Texinfo::Parser
tree
use Texinfo::Structuring qw(sectioning_structure nodes_tree number_floats
associate_internal_references split_by_node split_by_section split_pages
- merge_indices sort_indices elements_directions
- elements_file_directions);
+ merge_indices sort_indices elements_directions elements_file_directions);
+
# $tree is a Texinfo document tree. $parser is a Texinfo::Parser object.
+ # $config is an object implementing the get_conf() method.
my $registrar = $parser->registered_errors();
- my $sections_root = sectioning_structure ($registart, $parser, $tree);
+ my $sections_root = sectioning_structure ($registrar, $config, $tree);
my ($labels, $targets_list, $nodes_list) = $parser->labels_information();
my $parser_informations = $parser->global_informations();
my $global_commands = $parser->global_commands_information();
- set_menus_node_directions($registrar, $parser, $parser_informations,
+ set_menus_node_directions($registrar, $config, $parser_informations,
$global_commands, $nodes_list, $labels);
- my $top_node = nodes_tree($registrar, $parser, $parser_informations,
$nodes_list, $labels);
- complete_node_tree_with_menus($registrar, $parser, $nodes_list, $top_node);
+ my $top_node = nodes_tree($registrar, $config, $parser_informations,
$nodes_list, $labels);
+ complete_node_tree_with_menus($registrar, $config, $nodes_list, $top_node);
my $refs = $parser->internal_references_information();
- check_nodes_are_referenced($registrar, $parser, $nodes_list, $top_node,
$labels, $refs);
- number_floats($parser->floats_information());
+ check_nodes_are_referenced($registrar, $config, $nodes_list, $top_node,
$labels, $refs);
associate_internal_references($registrar, $parser, $parser_informations,
$labels, $refs);
+ number_floats($parser->floats_information());
my $elements;
if ($split_at_nodes) {
$elements = split_by_node($tree);
@@ -1787,15 +1751,18 @@ Texinfo::Structuring - information on Texinfo::Parser
tree
=head1 DESCRIPTION
Texinfo::Structuring first allows to collect informations on a Texinfo tree.
-In most case, it also requires a parser object to do that job. Thanks to
-C<sectioning_structure> the hierarchy of sectioning commands is determined.
-The directions implied by menus are determined with
+In most case, it also requires informations from a parser object to do that
+job. Thanks to C<sectioning_structure> the hierarchy of sectioning commands is
+determined. The directions implied by menus are determined with
C<set_menus_node_directions>. The node tree is analysed with C<nodes_tree>.
Nodes directions are completed with menu directions with
C<complete_node_tree_with_menus>. Floats get their standard numbering with
C<number_floats> and internal references are matched up with nodes, floats or
anchors with C<associate_internal_references>.
+The following methods depend on the output format, so are usually called
+from converters.
+
It is also possible to group the top-level contents of the tree, which consist
in nodes and sectioning commands into elements that group together a node and
the next sectioning element. With C<split_by_node> nodes are considered
@@ -1818,11 +1785,181 @@ with C<sort_indices>.
No method is exported in the default case.
-Most of those function references takes a Texinfo::Parser object
-as argument, see L<Texinfo::Parser>.
+Most methods takes a Texinfo::Report I<$registrar> as argument
+for error reporting, see L<Texinfo::Report>. Most also require
+configuration information, which means an object implementing
+the get_conf() method, in practice the main program configuration
+or a converter. Other common input arguments such as parser information,
+labels or refs are obtained from a parser, see L<Texinfo::Parser>.
+
+=over
+
+=item associate_internal_references($registrar, $configuration_informations,
$parser_informations, $labels, $refs)
+
+Verify that internal references (C<@ref> and similar without
+fourth of fifth argument) have an associated node, anchor or float.
+Set the I<label> key in the I<extra> hash of the reference tree
+element to the associated labeled tree element. Register errors
+in C<$registrar>.
+
+=item check_nodes_are_referenced($registrar, $configuration_informations,
$nodes_list, $top_node, $labels, $refs)
+
+Check that all the nodes are referenced (in menu, @*ref or node direction).
+Register errors in C<$registrar>.
+
+Should be called after C<complete_node_tree_with_menus> in order to
+have the autogenerated menus available.
+
+=item complete_node_tree_with_menus($registrar, $configuration_informations,
$nodes_list, $top_node)
+
+Complete nodes directions with menu directions. Check consistency
+of menus, sectionning and nodes direction structures.
+Register errors in C<$registrar>.
+
+=item elements_directions($parser, $configuration_informations, $elements)
+
+Directions are set up for the elements in the array reference given in
+argument. The corresponding hash reference is in
+C<< {'extra'}->{'directions'} >>
+and keys correspond to directions while values are elements.
+
+The following directions are set up:
+
+=over
+
+=item This
+
+The element itself.
+
+=item Forward
+
+Element next.
+
+=item Back
+
+Previous element.
+
+=item NodeForward
+
+Following node element in reading order. It is the next node, or the
+first in menu or the next of the up node.
+
+=item NodeBack
+
+Preceding node element.
+
+=item NodeUp
+
+=item NodeNext
+
+=item NodePrev
+
+The up, next and previous node elements.
+
+=item Up
+
+=item Next
+
+=item Prev
+
+The up, next and previous section elements.
+
+=item FastForward
+
+The next top level section element.
+
+=item FastBack
+
+For top level elements, the previous top level element. For other elements
+the up top level element. For example, for a chapter element it is the
+previous chapter, for a subsection element it is the chapter element
+that contains the subsection.
+
+=item FastForward
+
+The next top level element.
+
+=back
+
+=item elements_file_directions($elements)
+
+In the directions reference described above for C<elements_directions>, sets
+the I<PrevFile> and C<NextFile> directions to the elements in previous and
+following files.
+
+It also sets C<FirstInFile*> directions for all the elements by using
+the directions of the first element in file. So, for example,
+C<FirstInFileNodeNext> is the next node of the first element in
+the file of each element.
+
+The API for association of pages/elements to files is not defined yet.
+
+=item @nodes_list = get_node_node_childs_from_sectioning($node)
+
+C<$node> is a node tree element. Find the node C<$node> children based
+on the sectioning structure. For the node associated with C<@top>
+sectioning command, the sections associated with parts are considered.
+
+=item sub index_entry_sort_string($main_entry, $entry_tree_element, $sortas,
$options, $ignore_chars)
+
+TODO
+
+=item $merged_entries = merge_indices($index_names)
+
+Using informations returned by L<Texinfo::Parser/indices_information>,
+a structure holding all the index entries by index name is returned,
+with all the entries of merged indices merged with those of the indice
+merged into.
+
+The I<$merged_entries> returned is a hash reference whose
+keys are the index names and values arrays of index entry structures
+described in details in L<Texinfo::Parser/index_entries>.
+
+=item $new_block = new_block_command($content, $parent, $command_name)
+
+Returns the texinfo tree corresponding to a block command named
+C<$command_name> with contents C<$content> and parent in tree C<$parent>.
+
+=item $new_menu new_complete_node_menu($node, $use_sections)
+
+Returns a texinfo tree menu for node C<$node>, pointing to the children
+of the node obtained with the sectioning structure. If C<$use_sections>
+is set, use section names instead of node names in menu.
+
+=item $entry = new_node_menu_entry($node, $use_sections)
+
+Returns the texinfo tree corresponding to a single menu entry pointing to
+C<$node>. If C<$use_section> is set, use the section name instead of node
name.
+
+=item my $top_node = nodes_tree($registrar, $configuration_informations,
$parser_informations, $nodes_list, $labels)
+
+Goes through nodes and set directions. Returns the top
+node. Register errors in C<$registrar>.
+
+This functions sets:
=over
+=item node_up
+
+=item node_prev
+
+=item node_next
+
+Up, next and previous directions for the node.
+
+=back
+
+=item number_floats($float_information)
+
+Number the floats as described in the Texinfo manual. Sets
+the I<number> key of the float tree elements.
+
+=item $level = section_level($section)
+
+Return numbered level of the tree sectioning C<$section>, as modified by
+raise/lowersections.
+
=item $sections_root, $sections_list = sectioning_structure ($registrar,
$configuration_informations, $tree)
This function goes through the tree and gather information on
@@ -1890,58 +2027,29 @@ Up, next and previous directions as set in menus.
=back
-=item my $top_node = nodes_tree($registrar, $configuration_informations,
$parser_informations, $nodes_list, $labels)
-
-Goes through nodes and set directions. Returns the top
-node. Register errors in C<$registrar>.
-
-This functions sets:
-
-=over
+=item setup_index_entry_keys_formatting($self, $configuration_informations)
-=item node_up
-
-=item node_prev
-
-=item node_next
+TODO
-Up, next and previous directions for the node.
+=item ($index_entries_sorted, $index_entries_sort_strings) =
sort_indices($parser, $registrar, $configuration_informations,
$merged_index_entries, $sort_by_letter)
-=back
+If C<$sort_by_letter> is set, sort by letter, otherwise sort all
+entries together. In both cases, a hash reference with index names
+as keys C<$index_entries_sorted> is returned.
-=item complete_node_tree_with_menus($registrar, $configuration_informations,
$nodes_list, $top_node)
+When sorting by letter, an array reference of letter hash references is
+associated with each index name. Each letter hash reference has two
+keys, a I<letter> key with the letter, and an I<entries> key with an array
+reference of sorted index entries beginning with the letter.
-Complete nodes directions with menu directions. Check consistency
-of menus, sectionning and nodes direction structures.
-Register errors in C<$registrar>.
+When simply sorting, the array of the sorted index entries is associated
+with the index name.
-=item check_nodes_are_referenced($registrar, $configuration_informations,
$nodes_list, $top_node, $labels, $refs)
+C<$index_entries_sort_strings> is a hash reference associating the index
+entries with the strings that were used to sort them.
-Check that all the nodes are referenced (in menu, @*ref or node direction).
Register errors in C<$registrar>.
-Should be called after C<complete_node_tree_with_menus> in order to
-have the autogenerated menus available.
-
-=item number_floats($float_information)
-
-Number the floats as described in the Texinfo manual. Sets
-the I<number> key of the float tree elements.
-
-=item associate_internal_references($registrar, $configuration_informations,
$parser_informations, $labels, $refs)
-
-Verify that internal references (C<@ref> and similar without
-fourth of fifth argument) have an associated node, anchor or float.
-Set the I<label> key in the I<extra> hash of the reference tree
-element to the associated labeled tree element. Register errors
-in C<$registrar>.
-
-=item warn_non_empty_parts($registrar, $configuration_informations,
$global_commands)
-
-Register a warning in C<$registrar> for each C<@part> that is not empty
-in C<$global_commands> information (typically obtained by calling
-C<global_commands_information()> on a parser).
-
=item $elements = split_by_node($tree)
Returns a reference array of elements where a node is associated to
@@ -2010,113 +2118,11 @@ No splitting, only one page is returned, holding all
the elements.
=back
-=item elements_directions($parser, $configuration_informations, $elements)
-
-Directions are set up for the elements in the array reference given in
-argument. The corresponding hash reference is in
-C<< {'extra'}->{'directions'} >>
-and keys correspond to directions while values are elements.
-
-The following directions are set up:
-
-=over
-
-=item This
-
-The element itself.
-
-=item Forward
-
-Element next.
-
-=item Back
-
-Previous element.
-
-=item NodeForward
-
-Following node element in reading order. It is the next node, or the
-first in menu or the next of the up node.
-
-=item NodeBack
-
-Preceding node element.
-
-=item NodeUp
-
-=item NodeNext
-
-=item NodePrev
-
-The up, next and previous node elements.
-
-=item Up
-
-=item Next
-
-=item Prev
-
-The up, next and previous section elements.
-
-=item FastForward
-
-The next top level section element.
-
-=item FastBack
-
-For top level elements, the previous top level element. For other elements
-the up top level element. For example, for a chapter element it is the
-previous chapter, for a subsection element it is the chapter element
-that contains the subsection.
-
-=item FastForward
-
-The next top level element.
-
-=back
-
-=item elements_file_directions($elements)
-
-In the directions reference described above for C<elements_directions>, sets
-the I<PrevFile> and C<NextFile> directions to the elements in previous and
-following files.
-
-It also sets C<FirstInFile*> directions for all the elements by using
-the directions of the first element in file. So, for example,
-C<FirstInFileNodeNext> is the next node of the first element in
-the file of each element.
-
-The API for association of pages/elements to files is not defined yet.
-
-=item $merged_entries = merge_indices($index_names)
-
-Using informations returned by L<Texinfo::Parser/indices_information>,
-a structure holding all the index entries by index name is returned,
-with all the entries of merged indices merged with those of the indice
-merged into.
-
-The I<$merged_entries> returned is a hash reference whose
-keys are the index names and values arrays of index entry structures
-described in details in L<Texinfo::Parser/index_entries>.
-
-=item ($index_entries_sorted, $index_entries_sort_strings) =
sort_indices($parser, $registrar, $configuration_informations,
$merged_index_entries, $sort_by_letter)
-
-If C<$sort_by_letter> is set, sort by letter, otherwise sort all
-entries together. In both cases, a hash reference with index names
-as keys C<$index_entries_sorted> is returned.
-
-When sorting by letter, an array reference of letter hash references is
-associated with each index name. Each letter hash reference has two
-keys, a I<letter> key with the letter, and an I<entries> key with an array
-reference of sorted index entries beginning with the letter.
-
-When simply sorting, the array of the sorted index entries is associated
-with the index name.
-
-C<$index_entries_sort_strings> is a hash reference associating the index
-entries with the strings that were used to sort them.
+=item warn_non_empty_parts($registrar, $configuration_informations,
$global_commands)
-Register errors in C<$registrar>.
+Register a warning in C<$registrar> for each C<@part> that is not empty
+in C<$global_commands> information (typically obtained by calling
+C<global_commands_information()> on a parser).
=back
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index e90165b..72b8744 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -387,7 +387,7 @@ sub complete_node_menu($;$)
my $node = shift;
my $use_sections = shift;
- my @node_childs = Texinfo::Structuring::get_node_node_childs($node);
+ my @node_childs =
Texinfo::Structuring::get_node_node_childs_from_sectioning($node);
if (scalar(@node_childs)) {
my %existing_entries;
@@ -509,13 +509,6 @@ sub complete_tree_nodes_missing_menu($;$)
}
}
-sub _copy_contents($)
-{
- my $contents = shift;
- my $copy = Texinfo::Common::copy_tree({'contents' => $contents});
- return $copy->{'contents'};
-}
-
sub _print_down_menus($$);
sub _print_down_menus($$)
{
@@ -550,9 +543,10 @@ sub _print_down_menus($$)
and $node->{'extra'}->{'associated_section'}->{'args'}->[0]
and
$node->{'extra'}->{'associated_section'}->{'args'}->[0]->{'contents'}) {
$node_title_contents
- =
_copy_contents($node->{'extra'}->{'associated_section'}->{'args'}->[0]->{'contents'});
+ = Texinfo::Common::copy_contents(
+
$node->{'extra'}->{'associated_section'}->{'args'}->[0]->{'contents'});
} else {
- $node_title_contents =
_copy_contents($node->{'extra'}->{'node_content'});
+ $node_title_contents =
Texinfo::Common::copy_contents($node->{'extra'}->{'node_content'});
}
my $menu_comment = {'type' => 'menu_comment'};
$menu_comment->{'contents'}->[0] = {'type' => 'preformatted',
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index eea117b..a0a7804 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -207,7 +207,7 @@ sub convert_tree ($$;$)
return $converter->protect_text(
Texinfo::Convert::Text::convert_to_text($tree,
- {Texinfo::Common::_convert_text_options($converter),
+ {Texinfo::Common::copy_options_for_convert_text($converter),
%$options}));
}
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 517a7eb..7006003 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -191,7 +191,7 @@ sub highlight_process($$)
pop @{$tree->{'contents'}};
}
my $text = Texinfo::Convert::Text::convert_to_text($tree, {'code' => 1,
- Texinfo::Common::_convert_text_options($self)});
+
Texinfo::Common::copy_options_for_convert_text($self)});
# make sure that the text ends with a newline
chomp ($text);
$text .= "\n";
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 9183291..678108c 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -222,6 +222,21 @@ sub protect_perl_string($)
return $string;
}
+# re-associate top level command with the document_root in case a converter
+# split the document, by resetting their 'parent' key.
+sub unsplit($)
+{
+ my $root = shift;
+ if (!$root->{'type'} or $root->{'type'} ne 'document_root'
+ or !$root->{'contents'}) {
+ return;
+ }
+ foreach my $content (@{$root->{'contents'}}) {
+ $content->{'parent'} = $root;
+ }
+ return;
+}
+
sub compare_dirs_files($$;$)
{
my $dir1 = shift;
@@ -851,9 +866,8 @@ sub test($$)
my $parser = Texinfo::Parser::parser($completed_parser_options);
# take the initial values to record only if there is something new
- my $initial_index_names = $parser->indices_information();
# do a copy to compare the values and not the references
- $initial_index_names = dclone($initial_index_names);
+ my $initial_index_names = dclone(\%Texinfo::Common::index_names);
print STDERR " TEST $test_name\n" if ($self->{'DEBUG'});
my $result;
if (!$test_file) {
@@ -1043,7 +1057,7 @@ sub test($$)
# means that depending on the order of converters call, trees feed to
# converters may have a document_root as top level command parent or
# elements. All the converters will have the document_root as argument.
- Texinfo::Structuring::_unsplit($result);
+ unsplit($result);
my $elements;
if ($split eq 'node') {
$elements = Texinfo::Structuring::split_by_node($result);
@@ -1054,7 +1068,8 @@ sub test($$)
Texinfo::Structuring::elements_directions($parser, $labels, $elements);
$directions_text = '';
foreach my $element (@$elements) {
- $directions_text .= Texinfo::Structuring::_print_directions($element);
+ $directions_text .=
+ Texinfo::Structuring::print_element_directions($element);
}
}
if ($split_pages) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (%index_names), tp/t/test_utils.pl (test): complete the %index_names structure to have the 'contained_indices' field and use it as a reference in tests for the default index names structure.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parse_texi_text): remove a duplicate index building now always done in _set_errors_node_lists_labels_indices().
- Next by Date:
branch master updated: * tp/Texinfo/Convert/Text.pm (copy_options_for_convert_text), tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoXML.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/Structuring.pm, tp/init/chm.pm, tp/init/highlight_syntax.pm: move copy_options_for_convert_text() from Texinfo::Common to Tex [...]
- Previous by thread:
branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parse_texi_text): remove a duplicate index building now always done in _set_errors_node_lists_labels_indices().
- Next by thread:
branch master updated: * tp/Texinfo/Convert/Text.pm (copy_options_for_convert_text), tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoXML.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/Structuring.pm, tp/init/chm.pm, tp/init/highlight_syntax.pm: move copy_options_for_convert_text() from Texinfo::Common to Tex [...]
- Index(es):