[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 bffe582c550a7c4204856e843af262f1c769b98b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 8 20:54:05 2024 +0200
* tp/Texinfo/Document.pm (get_conf): add to use in pure Perl for the
get_conf cutomization getting API useing options registerd in the
parser. Remove options().
* tp/Texinfo/Structuring.pm (sectioning_structure)
(associate_internal_references),
tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
(associate_internal_references, sectioning_structure),
tp/t/automatic_menus.t, tp/t/automatic_nodes.t,
tp/t/convert_to_text.t, tp/t/do_master_menu.t, tp/t/test_tree_copy.t,
tp/t/test_utils.pl (test), tp/texi2any.pl: use $document argument to
get customization options, remove $main_configuration argument for
sectioning_structure and associate_internal_references.
---
ChangeLog | 16 ++++++++++++++++
tp/Texinfo/Document.pm | 10 ++++++++--
tp/Texinfo/Structuring.pm | 18 ++++++++++--------
.../XS/structuring_transfo/StructuringTransfoXS.xs | 6 ++----
tp/t/automatic_menus.t | 4 ++--
tp/t/automatic_nodes.t | 8 ++++----
tp/t/convert_to_text.t | 5 ++---
tp/t/do_master_menu.t | 8 ++++----
tp/t/test_tree_copy.t | 3 +--
tp/t/test_utils.pl | 8 ++++----
tp/texi2any.pl | 8 ++++----
11 files changed, 57 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8f07a2fe6e..949e7675d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-04-08 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Document.pm (get_conf): add to use in pure Perl for the
+ get_conf cutomization getting API useing options registerd in the
+ parser. Remove options().
+
+ * tp/Texinfo/Structuring.pm (sectioning_structure)
+ (associate_internal_references),
+ tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+ (associate_internal_references, sectioning_structure),
+ tp/t/automatic_menus.t, tp/t/automatic_nodes.t,
+ tp/t/convert_to_text.t, tp/t/do_master_menu.t, tp/t/test_tree_copy.t,
+ tp/t/test_utils.pl (test), tp/texi2any.pl: use $document argument to
+ get customization options, remove $main_configuration argument for
+ sectioning_structure and associate_internal_references.
+
2024-04-08 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm (%XS_overrides), tp/Texinfo/Config.pm
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index d3c0e0b81e..6902700ebd 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -237,10 +237,16 @@ sub register_options($$)
$self->{'options'} = $document_options;
}
-sub options($)
+sub get_conf($$)
{
my $self = shift;
- return $self->{'options'};
+ my $var = shift;
+
+ if (!$self->{'options'}) {
+ print STDERR "WARNING: $var: Document get_conf uninitialized options\n";
+ return undef;
+ }
+ return $self->{'options'}->{$var};
}
sub merged_indices($)
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 1242c1c4cd..b2ace7f21d 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -152,10 +152,11 @@ my %unnumbered_commands =
%Texinfo::Commands::unnumbered_commands;
# 'section_childs'
# 'section_directions'
# 'toplevel_directions'
-sub sectioning_structure($$)
+sub sectioning_structure($)
{
my $document = shift;
- my $customization_information = shift;
+
+ my $customization_information = $document;
my $root = $document->tree();
my $registrar = $document->registrar();
@@ -1153,10 +1154,11 @@ sub nodes_tree($$)
# For each internal reference command, set the 'normalized' key, in the
# @*ref first argument or in 'menu_entry_node' extra.
-sub associate_internal_references($$)
+sub associate_internal_references($)
{
my $document = shift;
- my $customization_information = shift;
+
+ my $customization_information = $document;
my $identifier_target = $document->labels_information();
my $refs = $document->internal_references_information();
@@ -2249,7 +2251,7 @@ Texinfo::Structuring - information on Texinfo::Document
tree
# $document is a parsed Texinfo::Document document, $tree is the
# associated Texinfo document tree. $config is an object implementing
# the get_conf() method.
- my $sections_list = sectioning_structure($document, $config);
+ my $sections_list = sectioning_structure($document);
my $identifier_target = $document->labels_information();
my $global_commands = $document->global_commands_information();
my $nodes_list = nodes_tree($document, $config);
@@ -2257,7 +2259,7 @@ Texinfo::Structuring - information on Texinfo::Document
tree
complete_node_tree_with_menus($document, $config);
my $refs = $document->internal_references_information();
check_nodes_are_referenced($document, $config);
- associate_internal_references($document, $config);
+ associate_internal_references($document);
number_floats($document->floats_information());
my $output_units;
if ($split_at_nodes) {
@@ -2319,7 +2321,7 @@ L<Texinfo::Document>.
=over
-=item associate_internal_references($document, $customization_information)
+=item associate_internal_references($document)
X<C<associate_internal_references>>
Verify that internal references (C<@ref> and similar without fourth of
@@ -2487,7 +2489,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($document,
$customization_information)
+=item $sections_list = sectioning_structure($document)
X<C<sectioning_structure>>
This function goes through the parsed document tree and gather information
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index e8b4faa5f6..1f337f1393 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -154,8 +154,7 @@ reference_to_arg_in_tree (SV *tree_in)
reference_to_arg_in_tree (document->tree, document);
void
-associate_internal_references (SV *document_in, ...)
- PROTOTYPE: $$
+associate_internal_references (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
@@ -169,8 +168,7 @@ associate_internal_references (SV *document_in, ...)
# to register in the document. It is better to reserve the return
# value for a return status, if it becomes needed.
void
-sectioning_structure (SV *document_in, ...)
- PROTOTYPE: $$
+sectioning_structure (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
diff --git a/tp/t/automatic_menus.t b/tp/t/automatic_menus.t
index 42acb0435a..e9d47458bb 100644
--- a/tp/t/automatic_menus.t
+++ b/tp/t/automatic_menus.t
@@ -28,9 +28,9 @@ sub test($$$;$$)
my $parser = Texinfo::Parser::parser();
my $document = $parser->parse_texi_text($in);
my $tree = $document->tree();
- Texinfo::Structuring::associate_internal_references($document, $parser);
+ Texinfo::Structuring::associate_internal_references($document);
- Texinfo::Structuring::sectioning_structure($document, $parser);
+ Texinfo::Structuring::sectioning_structure($document);
if ($complete_missing_menus) {
Texinfo::Transformations::complete_tree_nodes_missing_menu($tree, undef,
$use_sections);
diff --git a/tp/t/automatic_nodes.t b/tp/t/automatic_nodes.t
index d89e14974b..0812babd5a 100644
--- a/tp/t/automatic_nodes.t
+++ b/tp/t/automatic_nodes.t
@@ -34,13 +34,13 @@ sub test_new_node($$$$)
my $node_tree = $parser->parse_texi_line ($in);
my $document = $parser->parse_texi_text ('');
my $identifier_target = $document->labels_information();
- Texinfo::Structuring::associate_internal_references($document, $parser);
+ Texinfo::Structuring::associate_internal_references($document);
my $node = Texinfo::Transformations::_new_node($node_tree, $document);
my ($texi_result, $normalized);
if (defined($node)) {
$texi_result = Texinfo::Convert::Texinfo::convert_to_texinfo($node);
- Texinfo::Structuring::associate_internal_references($document, $parser);
+ Texinfo::Structuring::associate_internal_references($document);
$normalized = $node->{'extra'}->{'normalized'};
my @identifiers = sort(keys(%$identifier_target));
if (scalar(@identifiers) != 1) {
@@ -165,7 +165,7 @@ Text.
$parser = Texinfo::Parser::parser();
$document = $parser->parse_texi_text($sections_text);
-Texinfo::Structuring::associate_internal_references($document, $parser);
+Texinfo::Structuring::associate_internal_references($document);
Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
$parser);
#Texinfo::Document::rebuild_document($document);
@@ -186,7 +186,7 @@ $document = $parser->parse_texi_text('@node Top
* (some_manual)::
@end menu
');
-Texinfo::Structuring::associate_internal_references($document, $parser);
+Texinfo::Structuring::associate_internal_references($document);
Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
$parser);
diff --git a/tp/t/convert_to_text.t b/tp/t/convert_to_text.t
index c2e2444a4f..58a66330ac 100644
--- a/tp/t/convert_to_text.t
+++ b/tp/t/convert_to_text.t
@@ -72,11 +72,10 @@ my $tree = $document->tree();
#use Texinfo::DebugTree;
#print STDERR Texinfo::DebugTree->convert_tree ($tree);
-my $main_configuration = Texinfo::MainConfig::new();
# Setup sectioning commands numbers
my $sections_list
- = Texinfo::Structuring::sectioning_structure($document,
- $main_configuration);
+ = Texinfo::Structuring::sectioning_structure($document);
+
if ($sections_list) {
Texinfo::Document::register_document_sections_list($document,
$sections_list);
diff --git a/tp/t/do_master_menu.t b/tp/t/do_master_menu.t
index 390e783708..5add63c8c2 100644
--- a/tp/t/do_master_menu.t
+++ b/tp/t/do_master_menu.t
@@ -125,7 +125,7 @@ my $no_detailmenu = _get_in('');
my $parser = Texinfo::Parser::parser();
my $document = $parser->parse_texi_piece($in_detailmenu);
-Texinfo::Structuring::associate_internal_references($document, $parser);
+Texinfo::Structuring::associate_internal_references($document);
#Texinfo::Document::rebuild_document($document);
my $identifier_target = $document->labels_information();
my $top_node = $identifier_target->{'Top'};
@@ -172,7 +172,7 @@ is ($out, $reference, 'master menu');
$parser = Texinfo::Parser::parser();
$document = $parser->parse_texi_piece($no_detailmenu);
-Texinfo::Structuring::associate_internal_references($document, $parser);
+Texinfo::Structuring::associate_internal_references($document);
#Texinfo::Document::rebuild_document($document);
$identifier_target = $document->labels_information();
$top_node = $identifier_target->{'Top'};
@@ -185,7 +185,7 @@ is ($out, $reference, 'master menu no detailmenu');
$parser = Texinfo::Parser::parser();
$document = $parser->parse_texi_piece($in_detailmenu);
-Texinfo::Structuring::associate_internal_references($document, $parser);
+Texinfo::Structuring::associate_internal_references($document);
Texinfo::Transformations::regenerate_master_menu($document, $parser);
#Texinfo::Document::rebuild_document($document);
my $tree = $document->tree();
@@ -197,7 +197,7 @@ is ($out, _get_in($reference), 'regenerate with existing
detailmenu');
$parser = Texinfo::Parser::parser();
$document = $parser->parse_texi_piece($no_detailmenu);
-Texinfo::Structuring::associate_internal_references($document, $parser);
+Texinfo::Structuring::associate_internal_references($document);
Texinfo::Transformations::regenerate_master_menu($document, $parser);
#Texinfo::Document::rebuild_document($document);
$tree = $document->tree();
diff --git a/tp/t/test_tree_copy.t b/tp/t/test_tree_copy.t
index c9d1ab80af..d880a5f179 100644
--- a/tp/t/test_tree_copy.t
+++ b/tp/t/test_tree_copy.t
@@ -147,8 +147,7 @@ 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($document,
- $test_parser);
+Texinfo::Structuring::sectioning_structure($document);
# rebuild the tree
$tree = $document->tree();
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 0a58846fb3..f5f1c13132 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1097,11 +1097,11 @@ sub test($$)
$document, $main_configuration);
}
- Texinfo::Structuring::associate_internal_references($document,
- $main_configuration);
+ Texinfo::Structuring::associate_internal_references($document);
+
my $sections_list
- = Texinfo::Structuring::sectioning_structure($document,
- $main_configuration);
+ = Texinfo::Structuring::sectioning_structure($document);
+
if ($sections_list) {
Texinfo::Document::register_document_sections_list($document,
$sections_list);
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 622eac55db..1603251d48 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1622,14 +1622,14 @@ while(@input_files) {
$main_configuration);
}
- Texinfo::Structuring::associate_internal_references($document,
- $main_configuration);
+ Texinfo::Structuring::associate_internal_references($document);
+
# information obtained through Texinfo::Structuring
# and useful in converters.
# every format needs the sectioning structure
my $sections_list
- = Texinfo::Structuring::sectioning_structure($document,
- $main_configuration);
+ = Texinfo::Structuring::sectioning_structure($document);
+
if ($sections_list) {
Texinfo::Document::register_document_sections_list($document,
$sections_list);
- 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 <=
- [no subject], Patrice Dumas, 2024/04/08
- [no subject], Patrice Dumas, 2024/04/08