[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Structuring.pm (sectioning_structure
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Structuring.pm (sectioning_structure), tp/Texinfo/Transformations.pm (protect_hashchar_at_line_beginning): put tree first in arguments. Update callers and XS. |
Date: |
Wed, 25 Oct 2023 02:39:55 -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 0b6949faa3 * tp/Texinfo/Structuring.pm (sectioning_structure),
tp/Texinfo/Transformations.pm (protect_hashchar_at_line_beginning): put tree
first in arguments. Update callers and XS.
0b6949faa3 is described below
commit 0b6949faa39ec77952c261a9b29a6497098f6bd8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 25 08:39:56 2023 +0200
* tp/Texinfo/Structuring.pm (sectioning_structure),
tp/Texinfo/Transformations.pm (protect_hashchar_at_line_beginning):
put tree first in arguments. Update callers and XS.
* tp/t/test_tree_copy.t: call rebuild_tree.
---
ChangeLog | 8 ++++++++
Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm | 2 +-
Pod-Simple-Texinfo/pod2texi.pl | 2 +-
tp/Texinfo/Document.pm | 2 +-
tp/Texinfo/Structuring.pm | 6 +++---
tp/Texinfo/Transformations.pm | 15 ++++++++-------
tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs | 8 ++++----
tp/t/automatic_menus.t | 2 +-
tp/t/test_protect_hashchar_at_line_beginning.t | 4 ++--
tp/t/test_tree_copy.t | 6 ++++--
tp/t/test_utils.pl | 8 ++++----
tp/texi2any.pl | 4 ++--
12 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 386bc7a673..461b4fa2b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-10-25 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Structuring.pm (sectioning_structure),
+ tp/Texinfo/Transformations.pm (protect_hashchar_at_line_beginning):
+ put tree first in arguments. Update callers and XS.
+
+ * tp/t/test_tree_copy.t: call rebuild_tree.
+
2023-10-24 Patrice Dumas <pertusus@free.fr>
* tp/t/test_utils.pl (test): call rebuild_output_units unconditionally
diff --git a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
index c88f31b52f..6f46d3aae9 100644
--- a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+++ b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
@@ -373,7 +373,7 @@ sub _protect_hashchar($)
# FIXME use parse_texi_piece?
my $document = parse_texi_text(undef, $texinfo);
my $tree = $document->tree();
- protect_hashchar_at_line_beginning(undef, undef, $tree);
+ protect_hashchar_at_line_beginning($tree);
return Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
} else {
return $texinfo;
diff --git a/Pod-Simple-Texinfo/pod2texi.pl b/Pod-Simple-Texinfo/pod2texi.pl
index 5e8e32dc19..4702f60573 100755
--- a/Pod-Simple-Texinfo/pod2texi.pl
+++ b/Pod-Simple-Texinfo/pod2texi.pl
@@ -336,7 +336,7 @@ sub _parsed_manual_tree($$$$$)
}
}
}
- Texinfo::Structuring::sectioning_structure($registrar, $texi_parser, $tree);
+ Texinfo::Structuring::sectioning_structure($tree, $registrar, $texi_parser);
my $refs = $document->internal_references_information();
# this is needed to set 'normalized' for menu entries, they are
# used in complete_tree_nodes_menus.
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 5fe7fbb88e..8b12698591 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -425,7 +425,7 @@ by a call to
L<register_document_nodes_list|/register_document_nodes_list ($docu
=item $sections_list = sections_list($document)
Returns an array reference containing the document sections. In general set
to the
-sections list returned by L<Texinfo::Structuring
sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($registrar, $customization_information, $tree)>,
+sections list returned by L<Texinfo::Structuring
sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($tree, $registrar, $customization_information)>,
by a call to
L<register_document_sections_list|/register_document_sections_list ($document,
$sections_list)>.
=back
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 8d5f35a542..c610958eb4 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -222,9 +222,9 @@ sub copy_tree($;$)
# 'toplevel_directions'
sub sectioning_structure($$$)
{
+ my $root = shift;
my $registrar = shift;
my $customization_information = shift;
- my $root = shift;
my $sec_root;
my $previous_section;
@@ -2710,7 +2710,7 @@ Texinfo::Structuring - information on Texinfo::Document
tree
# associated 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_list = sectioning_structure ($registrar, $config, $tree);
+ my $sections_list = sectioning_structure($tree, $registrar, $config);
my $identifier_target = $document->labels_information();
my $global_commands = $document->global_commands_information();
my $nodes_list = nodes_tree($document, $registrar, $config);
@@ -2987,7 +2987,7 @@ Return the sectioning command name corresponding to the
sectioning
element I<$element>, adjusted in order to take into account raised
and lowered sections, when needed.
-=item $sections_list = sectioning_structure($registrar,
$customization_information, $tree)
+=item $sections_list = sectioning_structure($tree, $registrar,
$customization_information)
X<C<sectioning_structure>>
This function goes through the tree and gather information on the document
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index d147741ce9..d512032ce4 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -889,13 +889,14 @@ sub _protect_hashchar_at_line_beginning($$$)
return undef;
}
-sub protect_hashchar_at_line_beginning($$$)
+sub protect_hashchar_at_line_beginning($;$$)
{
+ my $tree = shift;
my $registrar = shift;
my $customization_information = shift;
- my $tree = shift;
- return Texinfo::Common::modify_tree($tree,
\&_protect_hashchar_at_line_beginning,
+ return Texinfo::Common::modify_tree($tree,
+ \&_protect_hashchar_at_line_beginning,
[$registrar, $customization_information]);
}
@@ -953,7 +954,7 @@ Add menu entries or whole menus for nodes associated with
sections,
based on the sectioning tree. If the optional
C<$add_section_names_in_entries> argument is set, a menu entry
name is added using the section name. This function should be
-called after L<sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($registrar, $customization_information, $tree)>.
+called after L<sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($tree, $registrar, $customization_information)>.
=item complete_tree_nodes_missing_menu($tree, $use_section_names_in_entries)
X<C<complete_tree_nodes_missing_menu>>
@@ -962,7 +963,7 @@ Add whole menus for nodes associated with sections and
without menu,
based on the sectioning tree. If the optional
C<$add_section_names_in_entries> argument is set, a menu entry
name is added using the section name. This function should be
-called after L<sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($registrar, $customization_information, $tree)>.
+called after L<sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($tree, $registrar, $customization_information)>.
=item $added_sections = fill_gaps_in_sectioning($tree)
X<C<fill_gaps_in_sectioning>>
@@ -1006,12 +1007,12 @@ I<preformatted> container.
Note that this kind of tree is not supported by other codes, so this
transformation should be avoided unless one knows exactly what to expect.
-=item protect_hashchar_at_line_beginning($registrar,
$customization_information, $tree)
+=item protect_hashchar_at_line_beginning($tree, $registrar,
$customization_information)
X<C<protect_hashchar_at_line_beginning>>
Protect hash (#) character at the beginning of line such that they would not be
considered as lines to be processed by the CPP processor. The I<$registrar>
-and I<$customization_information> arguments may be undef. If defined, the
+and I<$customization_information> arguments are optional. If defined, the
I<$registrar> argument should be a L<Texinfo::Report> object in which the
errors and warnings encountered while parsing are registered. If defined,
I<$customization_information> should give access to customization through
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
index 3620cbbc19..463970fb11 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
@@ -284,9 +284,9 @@ associate_internal_references (SV *document_in, ...)
# The perl function returns a list of sections, but it is only used
# to register in the document. It is better to reserve the return
# value for a return status, if it becomes needed.
-# TODO change call in perl code to put tree first
void
-sectioning_structure (SV *registrar, SV *customization_information, SV
*tree_in)
+sectioning_structure (SV *tree_in, ...)
+ PROTOTYPE: $$$
PREINIT:
DOCUMENT *document = 0;
CODE:
@@ -466,9 +466,9 @@ protect_node_after_label_in_tree (SV *tree_in)
if (document)
protect_node_after_label_in_tree (document->tree);
-# TODO change order of call in perl?
void
-protect_hashchar_at_line_beginning (SV *registrar, SV
*customization_information, SV *tree_in)
+protect_hashchar_at_line_beginning (SV *tree_in, ...)
+ PROTOTYPE: $;$$
PREINIT:
DOCUMENT *document = 0;
CODE:
diff --git a/tp/t/automatic_menus.t b/tp/t/automatic_menus.t
index 24a0b2df09..a238bd4eba 100644
--- a/tp/t/automatic_menus.t
+++ b/tp/t/automatic_menus.t
@@ -30,7 +30,7 @@ sub test($$$;$$)
Texinfo::Structuring::associate_internal_references($document, $registrar,
$parser);
- Texinfo::Structuring::sectioning_structure($registrar, $parser, $tree);
+ Texinfo::Structuring::sectioning_structure($tree, $registrar, $parser);
if ($complete_missing_menus) {
Texinfo::Transformations::complete_tree_nodes_missing_menu($tree,
$use_sections);
diff --git a/tp/t/test_protect_hashchar_at_line_beginning.t
b/tp/t/test_protect_hashchar_at_line_beginning.t
index de3f6338a4..bb3754504d 100644
--- a/tp/t/test_protect_hashchar_at_line_beginning.t
+++ b/tp/t/test_protect_hashchar_at_line_beginning.t
@@ -41,8 +41,8 @@ sub run_test($$$;$)
my $registrar = $parser->registered_errors();
my $corrected_tree =
- Texinfo::Transformations::protect_hashchar_at_line_beginning(
- $registrar, $parser, $tree);
+ Texinfo::Transformations::protect_hashchar_at_line_beginning($tree,
+ $registrar, $parser);
$document = Texinfo::Structuring::rebuild_document($document);
$corrected_tree = $document->tree();
diff --git a/tp/t/test_tree_copy.t b/tp/t/test_tree_copy.t
index d05b9fc4d9..8f7491bc4b 100644
--- a/tp/t/test_tree_copy.t
+++ b/tp/t/test_tree_copy.t
@@ -141,8 +141,10 @@ my $texi_copy =
Texinfo::Convert::Texinfo::convert_to_texinfo($copy);
is ($texi_copy, $texi_tree, "tree and copy to texi match");
# set sectioning structure and redo a copy
-Texinfo::Structuring::sectioning_structure($test_registrar,
- $test_parser, $tree);
+Texinfo::Structuring::sectioning_structure($tree, $test_registrar,
+ $test_parser);
+
+$tree = Texinfo::Structuring::rebuild_tree($tree);
my $copy_with_sec = Texinfo::Structuring::copy_tree($tree, undef);
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index c16007951d..ca7efaadd4 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1025,8 +1025,8 @@ sub test($$)
Texinfo::Structuring::associate_internal_references($document, $registrar,
$main_configuration);
my $sections_list
- = Texinfo::Structuring::sectioning_structure($registrar,
- $main_configuration, $tree);
+ = Texinfo::Structuring::sectioning_structure($tree, $registrar,
+ $main_configuration);
if ($sections_list) {
Texinfo::Document::register_document_sections_list($document,
$sections_list);
@@ -1070,8 +1070,8 @@ sub test($$)
foreach my $transformation (@$additional_tree_transformations) {
my $tree_transformation_sub = $tested_transformations{$transformation};
if ($transformation eq 'protect_hashchar_at_line_beginning') {
- &$tree_transformation_sub($registrar, $main_configuration,
- $document->tree());
+ &$tree_transformation_sub($document->tree(), $registrar,
+ $main_configuration);
} else {
&$tree_transformation_sub($document->tree());
}
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index dbe7a1f0ed..75f03ba720 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1575,8 +1575,8 @@ while(@input_files) {
# and useful in converters.
# every format needs the sectioning structure
my $sections_list
- = Texinfo::Structuring::sectioning_structure($registrar,
- $main_configuration, $tree);
+ = Texinfo::Structuring::sectioning_structure($tree, $registrar,
+ $main_configuration);
if ($sections_list) {
Texinfo::Document::register_document_sections_list($document,
$sections_list);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Structuring.pm (sectioning_structure), tp/Texinfo/Transformations.pm (protect_hashchar_at_line_beginning): put tree first in arguments. Update callers and XS.,
Patrice Dumas <=