[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_conversion
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_conversion_units) (_html_convert_convert, run_stage_handlers, _html_convert_output), tp/Texinfo/Structuring.pm (split_by_node, split_by_section) (_XS_unsplit, unsplit), tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_convert, html_convert_output), tp/Texinfo/XS/main/output_unit.c (split_by_node, split_by_section) (unsplit), tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs (split_by_node, split_by_section, unsplit): pass a document instead of [...] |
Date: |
Fri, 08 Mar 2024 17:55:28 -0500 |
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 58c88360f3 * tp/Texinfo/Convert/HTML.pm (_prepare_conversion_units)
(_html_convert_convert, run_stage_handlers, _html_convert_output),
tp/Texinfo/Structuring.pm (split_by_node, split_by_section) (_XS_unsplit,
unsplit), tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_convert,
html_convert_output), tp/Texinfo/XS/main/output_unit.c (split_by_node,
split_by_section) (unsplit),
tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs (split_by_node,
split_by_section, unsplit): pass [...]
58c88360f3 is described below
commit 58c88360f3c5cd013b92018fc830bae4bde1ade2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Mar 8 23:55:26 2024 +0100
* tp/Texinfo/Convert/HTML.pm (_prepare_conversion_units)
(_html_convert_convert, run_stage_handlers, _html_convert_output),
tp/Texinfo/Structuring.pm (split_by_node, split_by_section)
(_XS_unsplit, unsplit), tp/Texinfo/XS/convert/ConvertXS.xs
(html_convert_convert, html_convert_output),
tp/Texinfo/XS/main/output_unit.c (split_by_node, split_by_section)
(unsplit), tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
(split_by_node, split_by_section, unsplit): pass a document instead of
a tree in argument. Update callers.
---
ChangeLog | 12 ++++++++
doc/texi2any_api.texi | 6 ++--
tp/TODO | 13 +++++++++
tp/Texinfo/Convert/Converter.pm | 19 +++----------
tp/Texinfo/Convert/HTML.pm | 33 ++++++++++------------
tp/Texinfo/Convert/IXIN.pm | 7 +++--
tp/Texinfo/Convert/Info.pm | 6 ++--
tp/Texinfo/Convert/Plaintext.pm | 10 ++-----
tp/Texinfo/Indices.pm | 2 +-
tp/Texinfo/Structuring.pm | 21 ++++++++------
tp/Texinfo/XS/convert/ConvertXS.xs | 12 ++++----
tp/Texinfo/XS/convert/convert_html.c | 4 +--
tp/Texinfo/XS/main/output_unit.c | 10 +++++--
tp/Texinfo/XS/main/output_unit.h | 6 ++--
.../XS/structuring_transfo/StructuringTransfoXS.xs | 18 ++++++------
tp/ext/epub3.pm | 4 ++-
tp/ext/highlight_syntax.pm | 8 ++++--
tp/ext/latex2html.pm | 5 +++-
tp/ext/tex4ht.pm | 4 ++-
tp/t/init/spaces_in_line_breaks.init | 2 +-
tp/t/init/special_element_customization.pm | 2 +-
tp/t/init/translated_strings_customization.pm | 2 +-
tp/t/test_utils.pl | 6 ++--
23 files changed, 120 insertions(+), 92 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9ef5d4ddf9..8015623b83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-03-08 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_prepare_conversion_units)
+ (_html_convert_convert, run_stage_handlers, _html_convert_output),
+ tp/Texinfo/Structuring.pm (split_by_node, split_by_section)
+ (_XS_unsplit, unsplit), tp/Texinfo/XS/convert/ConvertXS.xs
+ (html_convert_convert, html_convert_output),
+ tp/Texinfo/XS/main/output_unit.c (split_by_node, split_by_section)
+ (unsplit), tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+ (split_by_node, split_by_section, unsplit): pass a document instead of
+ a tree in argument. Update callers.
+
2024-03-08 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/document_types.h (DOCUMENT): add a
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 58f4ff5724..63ffa125d6 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -2222,9 +2222,9 @@ within a priority class the order is the order of calling
The call of the user defined functions is:
@deftypefn {Function Reference} @var{$status} stage_handler @
- (@var{$converter}, @var{\%tree}, @var{$stage})
-@var{$converter} is a converter object. @var{\%tree} is the Texinfo
-tree root element. @var{$stage} is the current stage.
+ (@var{$converter}, @var{$document}, @var{$stage})
+@var{$converter} is a converter object. @var{$document} is the Texinfo
+parsed @code{Texinfo::Document} document. @var{$stage} is the current stage.
If @var{$status} is not 0 it means that an error occured.
If @var{$status} is positive, the user defined functions should
diff --git a/tp/TODO b/tp/TODO
index cd6f8c3c8c..4e12814b06 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,6 +10,19 @@ This is the todo list for texi2any
Before next release
===================
+Real tree:
+* Overriden in general except if !$XS_structuring
+ Texinfo/Common.pm relate_index_entries_to_table_items_in_tree
+* Texinfo/DebugTree.pm convert $document->tree
+* Texinfo/Structuring.pm nodes_tree sectioning_structure
+* Texinfo/Transformations.pm insert_nodes_for_sectioning_commands
+* Texinfo/Convert/Converter.pm output_tree
+
+Perl only
+Texinfo/ParserNonXS.pm
+
+handle on tree:
+t/test_utils.pl all over
Bugs
====
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 0a313a55cc..a68f1e7b37 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1631,22 +1631,11 @@ sub sort_element_counts($$;$$)
$converter->conversion_initialization($document);
- my $tree = $document->tree();
-
my $output_units;
if ($use_sections) {
- $output_units = Texinfo::Structuring::split_by_section($tree);
+ $output_units = Texinfo::Structuring::split_by_section($document);
} else {
- $output_units = Texinfo::Structuring::split_by_node($tree);
- }
-
- # cannot happen for now, but could in the past and could in the future.
- if (!$output_units) {
- my $name = 'NOT an output unit';
- my $converted_text = $converter->convert($document);
- my $count = _count_converted_text($converted_text, $count_words);
- my $result = "$count $name\n";
- return ([[$count, $name]], $result);
+ $output_units = Texinfo::Structuring::split_by_node($document);
}
my $max_count = 0;
@@ -2113,9 +2102,9 @@ C<convert_output_unit> takes a I<$converter> and an
output unit
I<$output_unit> as argument. The implementation of
C<convert_output_unit> of C<Texinfo::Convert::Converter> could be suitable in
many cases. Output units are typically returned by L<Texinfo::Structuring
-split_by_section|Texinfo::Structuring/$output_units = split_by_section($tree)>
+split_by_section|Texinfo::Structuring/$output_units =
split_by_section($document)>
or L<Texinfo::Structuring split_by_node|Texinfo::Structuring/$output_units =
-split_by_node($tree)>.
+split_by_node($document)>.
Output units are not relevant for all the formats, the Texinfo tree can also be
converted directly, in general by using C<output_tree>.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index acf8ceff4d..c2c6cbf365 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9947,15 +9947,15 @@ sub _html_set_pages_files($$$$$$$$$)
sub _prepare_conversion_units($$$)
{
my $self = shift;
- my $root = shift;
+ my $document = shift;
my $document_name = shift;
my ($output_units, $special_units, $associated_special_units);
if ($self->get_conf('USE_NODES')) {
- $output_units = Texinfo::Structuring::split_by_node($root);
+ $output_units = Texinfo::Structuring::split_by_node($document);
} else {
- $output_units = Texinfo::Structuring::split_by_section($root);
+ $output_units = Texinfo::Structuring::split_by_section($document);
}
# Needs to be set early in case it would be needed to find some region
@@ -11947,7 +11947,7 @@ sub _prepare_title_titlepage($$$$)
sub _html_convert_convert($$$$)
{
my $self = shift;
- my $root = shift;
+ my $document = shift;
my $output_units = shift;
my $special_units = shift;
@@ -12002,7 +12002,6 @@ sub convert($$)
$self->conversion_initialization($document);
my $converter_info;
- my $root = $document->tree();
# the presence of contents elements in the document is used in diverse
# places, set it once for all here
@@ -12023,7 +12022,7 @@ sub convert($$)
}
my ($output_units, $special_units, $associated_special_units)
- = $self->_prepare_conversion_units($root, undef);
+ = $self->_prepare_conversion_units($document, undef);
# setup global targets. It is not clearly relevant to have those
# global targets when called as convert, but the Top global
@@ -12056,7 +12055,7 @@ sub convert($$)
$self->_reset_info();
# main conversion here
- my $result = $self->_html_convert_convert($root, $output_units,
+ my $result = $self->_html_convert_convert($document, $output_units,
$special_units);
$self->conversion_finalization();
@@ -12203,7 +12202,7 @@ sub output_internal_links($)
sub run_stage_handlers($$$)
{
my $converter = shift;
- my $root = shift;
+ my $document = shift;
my $stage = shift;
my $stage_handlers = Texinfo::Config::GNUT_get_stage_handlers();
@@ -12216,7 +12215,7 @@ sub run_stage_handlers($$$)
if ($converter->get_conf('DEBUG')) {
print STDERR "RUN handler $handler_idx: stage $stage, priority
$priority\n";
}
- my $status = &{$handler}($converter, $root, $stage);
+ my $status = &{$handler}($converter, $document, $stage);
if ($status != 0) {
if ($status < 0) {
$converter->converter_document_error(
@@ -12428,7 +12427,7 @@ sub _prepare_converted_output_info($)
# units or root conversion
sub _html_convert_output($$$$$$$$)
{
- my ($self, $root, $output_units, $special_units, $output_file,
+ my ($self, $document, $output_units, $special_units, $output_file,
$destination_directory, $output_filename, $document_name) = @_;
my $text_output = '';
@@ -12588,8 +12587,6 @@ sub output($$)
$identifiers_target = $document->labels_information();
}
- my $root = $document->tree();
-
# set here early even though actual values are only set later on. It is
# therefore set in converter_info early too (using the reference).
$self->{'current_filename'} = undef;
@@ -12654,7 +12651,7 @@ sub output($$)
# Some information is not available yet.
$self->_reset_info();
- my $setup_status = $self->run_stage_handlers($root, 'setup');
+ my $setup_status = $self->run_stage_handlers($document, 'setup');
unless ($setup_status < $handler_fatal_error_level
and $setup_status > -$handler_fatal_error_level) {
$self->conversion_finalization();
@@ -12743,7 +12740,7 @@ sub output($$)
# Get the list of output units to be processed.
# Customization information in $self->{'conf'} is passed to XS code too.
my ($output_units, $special_units, $associated_special_units)
- = $self->_prepare_conversion_units($root, $document_name);
+ = $self->_prepare_conversion_units($document, $document_name);
# setup untranslated strings
$self->_translate_names();
@@ -12760,7 +12757,7 @@ sub output($$)
# formatting. Some information is not available yet.
$self->_reset_info();
- my $structure_status = $self->run_stage_handlers($root, 'structure');
+ my $structure_status = $self->run_stage_handlers($document, 'structure');
unless ($structure_status < $handler_fatal_error_level
and $structure_status > -$handler_fatal_error_level) {
$self->conversion_finalization();
@@ -12785,7 +12782,7 @@ sub output($$)
# TODO document that this stage handler is called with end of
# preamble documentlanguage.
- my $init_status = $self->run_stage_handlers($root, 'init');
+ my $init_status = $self->run_stage_handlers($document, 'init');
unless ($init_status < $handler_fatal_error_level
and $init_status > -$handler_fatal_error_level) {
$self->conversion_finalization();
@@ -12806,7 +12803,7 @@ sub output($$)
$self->_reset_info();
# conversion
- my $text_output = $self->_html_convert_output($root, $output_units,
+ my $text_output = $self->_html_convert_output($document, $output_units,
$special_units, $output_file, $destination_directory,
$output_filename, $document_name);
@@ -12830,7 +12827,7 @@ sub output($$)
$self->_do_js_files($destination_directory);
- my $finish_status = $self->run_stage_handlers($root, 'finish');
+ my $finish_status = $self->run_stage_handlers($document, 'finish');
unless ($finish_status < $handler_fatal_error_level
and $finish_status > -$handler_fatal_error_level) {
$self->conversion_finalization();
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index d5823b4660..2df145528c 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -325,8 +325,6 @@ sub output_ixin($$)
$self->conversion_initialization($document);
- my $root = $document->tree();
-
my ($output_file, $destination_directory, $output_filename)
= $self->determine_files_and_directory($self->{'output_format'});
@@ -419,7 +417,7 @@ sub output_ixin($$)
# FIXME vars: wait for Thien-Thi answer.
- my $output_units = Texinfo::Structuring::split_by_node($root);
+ my $output_units = Texinfo::Structuring::split_by_node($document);
# setting_commands is for @-commands appearing before the first node,
# while end_of_nodes_setting_commands holds, for @-commands names, the
# last @-command element.
@@ -903,6 +901,9 @@ sub output_ixin($$)
my $blobs = '';
my $blobs_index = '';
my $blob_nr = 0;
+
+ my $root = $document->tree();
+
my $collected_image_commands =
Texinfo::Common::collect_commands_list_in_tree(
$root,
['image']);
if (scalar(@{$collected_image_commands})) {
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 6b2dc4fe10..add6d4c844 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -69,8 +69,6 @@ sub output($$)
$self->conversion_initialization($document);
- my $root = $document->tree();
-
my $result;
my ($output_file, $destination_directory, $output_filename,
@@ -117,7 +115,7 @@ sub output($$)
my $header_bytes = length($header);
my $complete_header_bytes = $header_bytes;
- my $output_units = Texinfo::Structuring::split_by_node($root);
+ my $output_units = Texinfo::Structuring::split_by_node($document);
print STDERR "DOCUMENT\n" if ($self->get_conf('DEBUG'));
@@ -142,6 +140,8 @@ sub output($$)
{'lines' => $old_context->{'lines'}, 'bytes' => $old_context->{'bytes'},
'locations' => [], 'result' => '' };
push @{$self->{'count_context'}}, $new_context;
+
+ my $root = $document->tree();
$self->_convert($root);
$self->process_footnotes();
my $output = $self->_stream_result();
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 437a8304f8..6ed3e5b76b 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -652,11 +652,9 @@ sub convert($$)
$self->conversion_initialization($document);
$self->{'encoding_disabled'} = 1;
- my $root = $document->tree();
-
my $result = '';
- my $output_units = Texinfo::Structuring::split_by_node($root);
+ my $output_units = Texinfo::Structuring::split_by_node($document);
foreach my $output_unit (@$output_units) {
my $node_text = convert_output_unit($self, $output_unit);
@@ -676,8 +674,6 @@ sub output($$)
$self->conversion_initialization($document);
- my $root = $document->tree();
-
my $output_units;
if (defined($self->get_conf('OUTFILE'))
@@ -709,9 +705,9 @@ sub output($$)
}
if ($self->get_conf('USE_NODES')) {
- $output_units = Texinfo::Structuring::split_by_node($root);
+ $output_units = Texinfo::Structuring::split_by_node($document);
} else {
- $output_units = Texinfo::Structuring::split_by_section($root);
+ $output_units = Texinfo::Structuring::split_by_section($document);
}
Texinfo::Structuring::split_pages($output_units, $self->get_conf('SPLIT'));
diff --git a/tp/Texinfo/Indices.pm b/tp/Texinfo/Indices.pm
index 24d151e41a..8dfe04e800 100644
--- a/tp/Texinfo/Indices.pm
+++ b/tp/Texinfo/Indices.pm
@@ -688,7 +688,7 @@ sub sort_indices_by_letter($$$;$$)
return $sorted_index_entries;
}
-# Norally called through Texinfo::Document::merged_indices only
+# Normally called through Texinfo::Document::merged_indices only
sub merge_indices($)
{
my $indices_information = shift;
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index f61badeb71..1b87d0ce55 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1671,7 +1671,8 @@ sub _print_down_menus($$;$)
# depend on the previous association (if any).
sub split_by_node($)
{
- my $root = shift;
+ my $document = shift;
+ my $root = $document->tree();
my $output_units;
@@ -1726,7 +1727,8 @@ sub split_by_node($)
# association (if any).
sub split_by_section($)
{
- my $root = shift;
+ my $document = shift;
+ my $root = $document->tree();
my $output_units;
@@ -1770,7 +1772,7 @@ sub split_by_section($)
sub _XS_unsplit($)
{
- my $root = shift;
+ my $document = shift;
return -3;
}
@@ -1780,10 +1782,11 @@ sub _XS_unsplit($)
# always better to do it both for XS and perl.
sub unsplit($)
{
- my $root = shift;
+ my $document = shift;
- my $XS_unsplit_needed = _XS_unsplit($root);
+ my $XS_unsplit_needed = _XS_unsplit($document);
+ my $root = $document->tree();
if (!$root->{'type'} or $root->{'type'} ne 'document_root'
or !$root->{'contents'}) {
return 0;
@@ -2261,9 +2264,9 @@ Texinfo::Structuring - information on Texinfo::Document
tree
number_floats($document->floats_information());
my $output_units;
if ($split_at_nodes) {
- $output_units = split_by_node($tree);
+ $output_units = split_by_node($document);
} else {
- $output_units = split_by_section($tree);
+ $output_units = split_by_section($document);
}
split_pages($output_units, $split);
units_directions($config, $identifier_target, $output_units);
@@ -2547,7 +2550,7 @@ elements corresponding to menu directions.
=back
-=item $output_units = split_by_node($tree)
+=item $output_units = split_by_node($document)
X<C<split_by_node>>
Returns a reference array of output units where a node is associated to
@@ -2565,7 +2568,7 @@ Output units also have directions in the
C<tree_unit_directions>
hash reference, namely I<next> and I<prev> pointing to the
previous and the next output unit.
-=item $output_units = split_by_section($tree)
+=item $output_units = split_by_section($document)
X<C<split_by_section>>
Similarly with C<split_by_node>, returns an array of output units. This
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index d53db1cd3e..23c1f91dbd 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -1788,7 +1788,7 @@ void
reset_output_init_conf (SV *sv_in)
# my ($output_units, $special_units, $associated_special_units)
-# = $self->_prepare_conversion_units($root, $document_name);
+# = $self->_prepare_conversion_units($document, $document_name);
void
html_prepare_conversion_units (SV *converter_in, ...)
PROTOTYPE: $$$
@@ -2042,7 +2042,7 @@ html_prepare_title_titlepage (SV *converter_in, SV
*output_units_in, output_file
}
SV *
-html_convert_convert (SV *converter_in, SV *tree_in, SV *output_units_in, SV
*special_units_in)
+html_convert_convert (SV *converter_in, SV *document_in, SV *output_units_in,
SV *special_units_in)
PREINIT:
CONVERTER *self = 0;
DOCUMENT *document = 0;
@@ -2053,7 +2053,8 @@ html_convert_convert (SV *converter_in, SV *tree_in, SV
*output_units_in, SV *sp
self = get_sv_converter (converter_in, "html_convert_convert");
/* there could be strange results if the document and the converter
document
do not match. There is no reason why it would happen, though */
- document = get_sv_tree_document (tree_in, "html_convert_convert");
+ document = get_sv_document_document (document_in,
+ "html_convert_convert");
if (SvOK (output_units_in))
output_units_descriptor
= get_sv_output_units_descriptor (output_units_in,
@@ -2105,7 +2106,7 @@ html_convert_tree (SV *converter_in, SV *tree_in,
explanation)
RETVAL
SV *
-html_convert_output (SV *converter_in, SV *tree_in, SV *output_units_in, SV
*special_units_in, output_file, destination_directory, output_filename,
document_name)
+html_convert_output (SV *converter_in, SV *document_in, SV *output_units_in,
SV *special_units_in, output_file, destination_directory, output_filename,
document_name)
const char *output_file = (char *)SvPVutf8_nolen($arg);
const char *destination_directory = (char *)SvPVutf8_nolen($arg);
const char *output_filename = (char *)SvPVutf8_nolen($arg);
@@ -2119,7 +2120,8 @@ html_convert_output (SV *converter_in, SV *tree_in, SV
*output_units_in, SV *spe
CODE:
/* add warn string? */
self = get_sv_converter (converter_in, "html_convert_output");
- document = get_sv_tree_document (tree_in, "html_convert_output");
+ document = get_sv_document_document (document_in,
+ "html_convert_output");
if (SvOK (output_units_in))
output_units_descriptor
= get_sv_output_units_descriptor (output_units_in,
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 985a460fc6..822b78c0ab 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1682,9 +1682,9 @@ html_prepare_conversion_units (CONVERTER *self,
int output_units_descriptor;
if (self->conf->USE_NODES.integer > 0)
- output_units_descriptor = split_by_node (self->document->tree);
+ output_units_descriptor = split_by_node (self->document);
else
- output_units_descriptor = split_by_section (self->document->tree);
+ output_units_descriptor = split_by_section (self->document);
*output_units_descriptor_ref = output_units_descriptor;
/* Needs to be set early in case it would be needed to find some region
diff --git a/tp/Texinfo/XS/main/output_unit.c b/tp/Texinfo/XS/main/output_unit.c
index 3678596ec0..a1f116c6b2 100644
--- a/tp/Texinfo/XS/main/output_unit.c
+++ b/tp/Texinfo/XS/main/output_unit.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include "tree_types.h"
+#include "document_types.h"
/* for fatal */
#include "utils.h"
#include "tree.h"
@@ -135,8 +136,9 @@ add_to_output_unit_list (OUTPUT_UNIT_LIST *list,
OUTPUT_UNIT *output_unit)
/* in addition to splitting, register the output_units list */
int
-split_by_node (const ELEMENT *root)
+split_by_node (const DOCUMENT *document)
{
+ const ELEMENT *root = document->tree;
int output_units_descriptor = new_output_units_descriptor ();
OUTPUT_UNIT_LIST *output_units
= retrieve_output_units (output_units_descriptor);
@@ -204,8 +206,9 @@ split_by_node (const ELEMENT *root)
/* in addition to splitting, register the output_units list */
int
-split_by_section (const ELEMENT *root)
+split_by_section (const DOCUMENT *document)
{
+ const ELEMENT *root = document->tree;
int output_units_descriptor = new_output_units_descriptor ();
OUTPUT_UNIT_LIST *output_units
= retrieve_output_units (output_units_descriptor);
@@ -263,8 +266,9 @@ split_by_section (const ELEMENT *root)
}
int
-unsplit (const ELEMENT *root)
+unsplit (const DOCUMENT *document)
{
+ const ELEMENT *root = document->tree;
int unsplit_needed = 0;
int i;
diff --git a/tp/Texinfo/XS/main/output_unit.h b/tp/Texinfo/XS/main/output_unit.h
index d0f76a7d09..f91be65e95 100644
--- a/tp/Texinfo/XS/main/output_unit.h
+++ b/tp/Texinfo/XS/main/output_unit.h
@@ -11,9 +11,9 @@ extern const char *relative_unit_direction_name[];
OUTPUT_UNIT_LIST *retrieve_output_units (int output_units_descriptor);
size_t new_output_units_descriptor (void);
-int split_by_node (const ELEMENT *root);
-int split_by_section (const ELEMENT *root);
-int unsplit (const ELEMENT *root);
+int split_by_node (const DOCUMENT *document);
+int split_by_section (const DOCUMENT *document);
+int unsplit (const DOCUMENT *document);
void split_pages (OUTPUT_UNIT_LIST *output_units, const char *split);
OUTPUT_UNIT *new_output_unit (enum output_unit_type unit_type);
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index a0efd637c1..9239a48005 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -364,14 +364,14 @@ protect_first_parenthesis_in_targets (SV *tree_in)
protect_first_parenthesis_in_targets (document->tree);
SV *
-split_by_node (SV *tree_in)
+split_by_node (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
- document = get_sv_tree_document (tree_in, "split_by_node");
+ document = get_sv_document_document (document_in, "split_by_node");
if (document)
{
- int output_units_descriptor = split_by_node (document->tree);
+ int output_units_descriptor = split_by_node (document);
RETVAL = build_output_units_list (output_units_descriptor);
}
else
@@ -380,14 +380,14 @@ split_by_node (SV *tree_in)
RETVAL
SV *
-split_by_section (SV *tree_in)
+split_by_section (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
- document = get_sv_tree_document (tree_in, "split_by_section");
+ document = get_sv_document_document (document_in, "split_by_section");
if (document)
{
- int output_units_descriptor = split_by_section (document->tree);
+ int output_units_descriptor = split_by_section (document);
RETVAL = build_output_units_list (output_units_descriptor);
}
else
@@ -396,14 +396,14 @@ split_by_section (SV *tree_in)
RETVAL
int
-unsplit (SV *tree_in)
+unsplit (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
/* this is called even if there is no XS tree, so no error */
- document = get_sv_tree_document (tree_in, 0);
+ document = get_sv_document_document (document_in, 0);
if (document)
- RETVAL = unsplit (document->tree);
+ RETVAL = unsplit (document);
else
RETVAL = -1;
OUTPUT:
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 7f1ddec4bf..51d706c36a 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -566,7 +566,9 @@ texinfo_register_handler('setup', \&epub_setup);
sub epub_finish($$)
{
my $self = shift;
- my $document_root = shift;
+ my $document = shift;
+
+ my $document_root = $document->tree();
my @epub_output_filenames = (@epub_output_units_filenames,
@epub_special_elements_filenames);
diff --git a/tp/ext/highlight_syntax.pm b/tp/ext/highlight_syntax.pm
index af9e68b2a6..b793ea0d99 100644
--- a/tp/ext/highlight_syntax.pm
+++ b/tp/ext/highlight_syntax.pm
@@ -66,7 +66,9 @@ texinfo_register_command_opening('example',
sub highlight_setup($$)
{
my $self = shift;
- my $document_root = shift;
+ my $document = shift;
+
+ my $document_root = $document->tree();
%highlighted_languages_list = ();
@@ -277,7 +279,9 @@ my %commands;
sub highlight_process($$)
{
my $self = shift;
- my $document_root = shift;
+ my $document = shift;
+
+ my $document_root = $document->tree();
# initialization, important in case multiple manuals are processed
%commands = (); # associates a command name and element to the
resulting
diff --git a/tp/ext/latex2html.pm b/tp/ext/latex2html.pm
index e7829a1deb..d48dee8673 100644
--- a/tp/ext/latex2html.pm
+++ b/tp/ext/latex2html.pm
@@ -168,7 +168,10 @@ my @l2h_from_html;
sub l2h_process($$)
{
my $self = shift;
- my $document_root = shift;
+ my $document = shift;
+
+ my $document_root = $document->tree();
+
@latex_texts = (); # array used to associate the index with
# a latex text.
$latex_commands_count = undef;
diff --git a/tp/ext/tex4ht.pm b/tp/ext/tex4ht.pm
index 19913a191e..37050e1237 100644
--- a/tp/ext/tex4ht.pm
+++ b/tp/ext/tex4ht.pm
@@ -92,7 +92,9 @@ sub tex4ht_prepare($$)
{
# set file names
my $self = shift;
- my $document_root = shift;
+ my $document = shift;
+
+ my $document_root = $document->tree();
# this initialization may not be needed, but it is cleaner anyway,
# in case there is more than one texinfo file processed.
diff --git a/tp/t/init/spaces_in_line_breaks.init
b/tp/t/init/spaces_in_line_breaks.init
index 3945efc4e4..b532dfdd72 100644
--- a/tp/t/init/spaces_in_line_breaks.init
+++ b/tp/t/init/spaces_in_line_breaks.init
@@ -5,7 +5,7 @@ texinfo_register_handler('setup',
\&_texi2any_tests_set_line_break_element);
sub _texi2any_tests_set_line_break_element
{
- my ($self, $tree, $stage) = @_;
+ my ($self, $document, $stage) = @_;
$self->{'line_break_element'} = '<br >';
return 0;
diff --git a/tp/t/init/special_element_customization.pm
b/tp/t/init/special_element_customization.pm
index 17283ae706..5e100136d2 100644
--- a/tp/t/init/special_element_customization.pm
+++ b/tp/t/init/special_element_customization.pm
@@ -54,7 +54,7 @@
texinfo_register_formatting_function('format_translate_message',
my $button_added;
sub _texi2any_tests_special_unit_add_button
{
- my ($self, $tree, $stage) = @_;
+ my ($self, $document, $stage) = @_;
if (!$button_added) {
my @section_buttons = @{$self->get_conf('SECTION_BUTTONS')};
diff --git a/tp/t/init/translated_strings_customization.pm
b/tp/t/init/translated_strings_customization.pm
index f152deca29..8ff639893e 100644
--- a/tp/t/init/translated_strings_customization.pm
+++ b/tp/t/init/translated_strings_customization.pm
@@ -58,7 +58,7 @@
texinfo_register_formatting_function('format_translate_message',
my $button_added;
sub _texi2any_tests_translate_add_button
{
- my ($self, $tree, $stage) = @_;
+ my ($self, $document, $stage) = @_;
if (!$button_added) {
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 927820b9b0..f7e1db9d38 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1361,7 +1361,7 @@ sub test($$)
# on conversion should be fairly well tested. See above the comment
# near test_split with more explanation on why previous splitting should
# not interfere with conversion.
- my $unsplit_needed = Texinfo::Structuring::unsplit($tree);
+ my $unsplit_needed = Texinfo::Structuring::unsplit($document);
print STDERR " UNSPLIT: $test_name\n"
if ($self->{'DEBUG'} and $unsplit_needed);
@@ -1374,9 +1374,9 @@ sub test($$)
# output units.
my $output_units;
if ($test_split eq 'node') {
- $output_units = Texinfo::Structuring::split_by_node($tree);
+ $output_units = Texinfo::Structuring::split_by_node($document);
} elsif ($test_split eq 'section') {
- $output_units = Texinfo::Structuring::split_by_section($tree);
+ $output_units = Texinfo::Structuring::split_by_section($document);
}
if ($test_split) {
my $identifier_target = $document->labels_information();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_conversion_units) (_html_convert_convert, run_stage_handlers, _html_convert_output), tp/Texinfo/Structuring.pm (split_by_node, split_by_section) (_XS_unsplit, unsplit), tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_convert, html_convert_output), tp/Texinfo/XS/main/output_unit.c (split_by_node, split_by_section) (unsplit), tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs (split_by_node, split_by_section, unsplit): pass a document instead of [...],
Patrice Dumas <=