[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 8 Apr 2024 15:45:49 -0400 (EDT) |
branch: master
commit d8a0a8ad736faafc363d11d1ee650b9017b48632
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 8 21:45:13 2024 +0200
* tp/Texinfo/Structuring.pm (warn_non_empty_parts)
(check_nodes_are_referenced, set_menus_node_directions)
(complete_node_tree_with_menus, nodes_tree): use $document argument to
get customization options, remove $main_configuration argument.
Update callers and XS interfaces.
---
Pod-Simple-Texinfo/pod2texi.pl | 8 +++---
tp/Texinfo/Transformations.pm | 29 ++++++++++------------
.../XS/structuring_transfo/StructuringTransfoXS.xs | 7 ++----
.../XS/structuring_transfo/transformations.c | 5 ----
tp/t/automatic_nodes.t | 11 +++-----
tp/t/test_utils.pl | 8 ++----
tp/texi2any.pl | 6 ++---
7 files changed, 26 insertions(+), 48 deletions(-)
diff --git a/Pod-Simple-Texinfo/pod2texi.pl b/Pod-Simple-Texinfo/pod2texi.pl
index 36bb4d9ab4..0b042383e8 100755
--- a/Pod-Simple-Texinfo/pod2texi.pl
+++ b/Pod-Simple-Texinfo/pod2texi.pl
@@ -302,16 +302,14 @@ sub _parsed_manual_tree($$$$$)
$commands_heading_content);
if ($section_nodes) {
Texinfo::Transformations::insert_nodes_for_sectioning_commands(
- $document, $texi_parser);
- #Texinfo::Document::rebuild_document($document);
+ $document);
}
}
- Texinfo::Structuring::sectioning_structure($document, $texi_parser);
+ Texinfo::Structuring::sectioning_structure($document);
my $refs = $document->internal_references_information();
# this is needed to set 'normalized' for menu entries, they are
# used in complete_tree_nodes_menus.
- Texinfo::Structuring::associate_internal_references($document,
- $texi_parser);
+ Texinfo::Structuring::associate_internal_references($document);
Texinfo::Transformations::complete_tree_nodes_menus($tree)
if ($section_nodes and $do_node_menus);
return ($texi_parser, $document, $identifier_target);
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 047a9ed13a..582912ef3d 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -430,11 +430,11 @@ sub _reassociate_to_node($$$)
return undef;
}
-sub insert_nodes_for_sectioning_commands($;$)
+sub insert_nodes_for_sectioning_commands($)
{
my $document = shift;
- my $customization_information = shift;
+ my $customization_information = $document;
my $root = $document->tree();
my @added_nodes;
@@ -626,12 +626,10 @@ sub complete_tree_nodes_missing_menu($;$$)
}
}
-# customization_information is used to pass down a translatable object with
-# customization information for the gdt() call.
-sub regenerate_master_menu($$;$)
+# The document is passed as customization information
+sub regenerate_master_menu($;$)
{
my $document = shift;
- my $customization_information = shift;
my $use_sections = shift;
my $identifier_target = $document->labels_information();
@@ -644,7 +642,7 @@ sub regenerate_master_menu($$;$)
or !scalar(@{$top_node->{'extra'}->{'menus'}}));
my $new_master_menu
- = Texinfo::Structuring::new_master_menu($customization_information,
+ = Texinfo::Structuring::new_master_menu($document,
$identifier_target, $top_node->{'extra'}->{'menus'},
$use_sections);
return undef if (!defined($new_master_menu));
@@ -997,13 +995,11 @@ If the sectioning commands are lowered or raised (with
C<@raisesections>,
C<@lowersection>) the tree may be modified with C<@raisesections> or
C<@lowersection> added to some tree elements.
-=item insert_nodes_for_sectioning_commands($document,
$customization_information)
+=item insert_nodes_for_sectioning_commands($document)
X<C<insert_nodes_for_sectioning_commands>>
Insert nodes for sectioning commands without node in C<$document>
-tree. I<$customization_information> is used for error reporting, though there
-should not be any errors as the node names are adapted such as not to clash
with
-existing label targets.
+tree.
=item menu_to_simple_menu($menu)
@@ -1047,13 +1043,14 @@ for the node name tree.
A I<$modified_tree> is not systematically returned, if the I<$tree> in argument
is not replaced, undef may also be returned.
-=item regenerate_master_menu($customization_information, $identifier_target)
+=item regenerate_master_menu($document, $use_sections)
X<C<regenerate_master_menu>>
-Regenerate the Top node master menu, replacing the first detailmenu
-in Top node menus or appending at the end of the Top node menu.
-I<$translations>, if defined, should be a L<Texinfo::Translations> object and
-should also hold customization information.
+Regenerate the I<$document> Top node master menu, replacing the first
+detailmenu in Top node menus or appending at the end of the Top node menu.
+
+I<$use_sections> is an optional argument. If set, sections associated with
+nodes are used as labels in the generated master menu.
=back
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 8e1e0338d9..08fdf628ec 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -264,10 +264,8 @@ complete_tree_nodes_missing_menu (SV *tree_in, SV
*customization_information=0,
complete_tree_nodes_missing_menu (document->tree, document,
document->options, use_sections);
-# regenerate_master_menu uses the options of the document, so we ignore
-# customization_information, which should contain the same information
void
-regenerate_master_menu (SV *document_in, SV *customization_information, SV
*use_sections_in=0)
+regenerate_master_menu (SV *document_in, SV *use_sections_in=0)
PREINIT:
DOCUMENT *document = 0;
int use_sections = 0;
@@ -283,8 +281,7 @@ regenerate_master_menu (SV *document_in, SV
*customization_information, SV *use_
# The perl function returns the list of added nodes.
void
-insert_nodes_for_sectioning_commands (SV *document_in, ...)
- PROTOTYPE: $;$
+insert_nodes_for_sectioning_commands (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 652d9cc6e8..ed226516ff 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -1126,11 +1126,6 @@ complete_tree_nodes_missing_menu (const ELEMENT *root,
DOCUMENT *document,
destroy_list (non_automatic_nodes);
}
-/* NOTE in perl there is a customization_information argument:
-# customization_information is used to pass down a translatable object with
-# customization information for the gdt() call.
-Here we use the document.
-*/
int
regenerate_master_menu (DOCUMENT *document, int use_sections)
{
diff --git a/tp/t/automatic_nodes.t b/tp/t/automatic_nodes.t
index 0812babd5a..0ed63dfa11 100644
--- a/tp/t/automatic_nodes.t
+++ b/tp/t/automatic_nodes.t
@@ -165,10 +165,10 @@ Text.
$parser = Texinfo::Parser::parser();
$document = $parser->parse_texi_text($sections_text);
+
Texinfo::Structuring::associate_internal_references($document);
-Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
- $parser);
-#Texinfo::Document::rebuild_document($document);
+Texinfo::Transformations::insert_nodes_for_sectioning_commands($document);
+
$tree = $document->tree();
my $result = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
is ($result, $reference, 'add nodes');
@@ -187,10 +187,7 @@ $document = $parser->parse_texi_text('@node Top
@end menu
');
Texinfo::Structuring::associate_internal_references($document);
-Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
- $parser);
-
-#Texinfo::Document::rebuild_document($document);
+Texinfo::Transformations::insert_nodes_for_sectioning_commands($document);
my $identifier_target = $document->labels_information();
my $indices_information = $document->indices_information();
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index c774f6795d..fcd9f95dd7 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1094,7 +1094,7 @@ sub test($$)
if ($tree_transformations{'insert_nodes_for_sectioning_commands'}) {
Texinfo::Transformations::insert_nodes_for_sectioning_commands(
- $document, $main_configuration);
+ $document);
}
Texinfo::Structuring::associate_internal_references($document);
@@ -1116,8 +1116,7 @@ sub test($$)
}
if ($tree_transformations{'regenerate_master_menu'}) {
- Texinfo::Transformations::regenerate_master_menu($document,
- $document);
+ Texinfo::Transformations::regenerate_master_menu($document);
}
my $nodes_tree_nodes_list
@@ -1149,9 +1148,6 @@ sub test($$)
}
}
- # could be in a if !$XS_structuring, but the function should not be
- # overriden already in that case
- #Texinfo::Document::rebuild_document($document);
$tree = $document->tree();
my $indices_information = $document->indices_information();
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 2b4bd12e97..72acdea689 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1618,8 +1618,7 @@ while(@input_files) {
}
if ($tree_transformations{'insert_nodes_for_sectioning_commands'}) {
- Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
- $main_configuration);
+ Texinfo::Transformations::insert_nodes_for_sectioning_commands($document);
}
Texinfo::Structuring::associate_internal_references($document);
@@ -1647,8 +1646,7 @@ while(@input_files) {
}
if ($tree_transformations{'regenerate_master_menu'}) {
- Texinfo::Transformations::regenerate_master_menu($document,
- $document);
+ Texinfo::Transformations::regenerate_master_menu($document);
}
if ($formats_table{$converted_format}->{'nodes_tree'}) {
- master updated (e0c04573b4 -> d8a0a8ad73), Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08
- [no subject],
Patrice Dumas <=
- [no subject], Patrice Dumas, 2024/04/08