[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 10 Apr 2024 05:13:31 -0400 (EDT) |
branch: master
commit cdf583c3489296eb89c99472b36d8210c3a1db69
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Apr 9 23:01:20 2024 +0200
* tp/texi2any.pl: call Texinfo::Convert::Texinfo->import(). Move code
around.
* tp/Texinfo/Document.pm: Update POD documentation.
---
ChangeLog | 7 +++++++
tp/Texinfo/Document.pm | 35 ++++++++++++++++++-----------------
tp/texi2any.pl | 12 ++++++------
3 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e87a39fab0..a969677044 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-04-09 Patrice Dumas <pertusus@free.fr>
+
+ * tp/texi2any.pl: call Texinfo::Convert::Texinfo->import(). Move code
+ around.
+
+ * tp/Texinfo/Document.pm: Update POD documentation.
+
2024-04-08 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Document.pm (%XS_overrides, register_document_options),
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 3ee3b01228..73318940cc 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -844,11 +844,10 @@ in
L<C<Texinfo::Report::errors>|Texinfo::Report/($error_warnings_list, $error_co
=head2 Getting customization options values registered in document
By default, customization information is registered in a document object
-after parsing the Texinfo code. This is used by structuring and tree
-transformation methods that find customization variables values in the
-document object they get in argument. The customization variable set by
-default may only be a subset of the possible customization variables,
-selected to be useful for structuring and tree transformation codes.
+just after parsing the Texinfo code. Structuring and tree transformation
+methods then get customization variables values from the document object
+they have in argument. The customization variables set by default may be a
+subset selected to be useful for structuring and tree transformation codes.
To retrieve Texinfo customization variables you can call C<get_conf>:
@@ -888,28 +887,30 @@ Register the I<$nodes_list> array reference as
I<$document> nodes
list. This method should be called after the processing of document
structure.
-=item register_document_sections_list ($document, $sections_list)
-X<C<register_document_sections_list>>
-
-Register the I<$sections_list> array reference as I<$document> sections
-list. This method should be called after the processing of document
-structure.
-
=item register_document_options ($document, $options)
X<C<register_document_options>>
The I<$options> hash reference holds options for the document. These options
should be Texinfo customization options. Usually, the options registered in
-the document are those useful for structuring and tree transformation
+the document contain those useful for structuring and tree transformation
getting place between Texinfo code parsing and conversion to output formats.
-The method should in general be called before the calls to C<get_conf>.
+Indeed, document customization options are mainly accessed by structuring and
+tree transformation methods (by calling L<< C<get_conf>|/$value =
$document->get_conf($variable_name) >>). The options should in general be
registered before
+the calls to C<get_conf>.
+
+=item register_document_sections_list ($document, $sections_list)
+X<C<register_document_sections_list>>
+
+Register the I<$sections_list> array reference as I<$document> sections
+list. This method should be called after the processing of document
+structure.
=item set_document_global_info($document, $key, $value)
X<C<set_document_global_info>>
-Add I<$value> I<$key> information to I<$document>. This method should not be
-generally useful, as document global information is already set by the
-Texinfo parser. The information set should be available through
+Add I<$value> I<$key> global information to I<$document>. This method
+should not be generally useful, as document global information is already
+set by the Texinfo parser. The information set should be available through
the next calls to L<global_information|/$info = global_information($document)>.
The method should in general be called before the calls to
C<global_information>.
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index ac9e492860..c8e0cf636b 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1520,11 +1520,6 @@ while(@input_files) {
goto NEXT;
}
- # Get the tree object. Note that if XS structuring in on, the argument
- # prevents the tree being built as a Perl structure at this stage; only
- # a "handle" is returned.
- my $tree = $document->tree($XS_structuring);
-
# setup a configuration Perl object which defines get_conf and set_conf,
# use the main program customization information with per-document
# customization. This allows to use functions calling get_conf and
@@ -1562,12 +1557,17 @@ while(@input_files) {
my $document_options = $main_configuration->get_customization_options_hash();
$document->register_document_options($document_options);
+ # Get the tree object. Note that if XS structuring in on, the argument
+ # prevents the tree being built as a Perl structure at this stage; only
+ # a "handle" is returned.
+ my $tree = $document->tree($XS_structuring);
+
if (defined(get_conf('MACRO_EXPAND')) and $file_number == 0) {
require Texinfo::Convert::Texinfo;
+ Texinfo::Convert::Texinfo->import();
# if convert_to_texinfo is not XS code get Perl tree.
if (not (defined $ENV{TEXINFO_XS_CONVERT}
and $ENV{TEXINFO_XS_CONVERT} eq '1')) {
- #Texinfo::Document::rebuild_document($document);
$tree = $document->tree();
}
my $texinfo_text = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);