[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Thu, 18 Jan 2024 18:44:53 -0500 (EST) |
branch: master
commit efd6c3e7a012837690ee0b4cb0550c80d611b84a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jan 18 23:30:42 2024 +0100
* tp/Texinfo/Convert/Converter.pm (set_document),
tp/Texinfo/Convert/HTML.pm (_convert_heading_command)
(_convert_contents_command, _contents_shortcontents_in_title)
(_set_root_commands_targets_node_files, _prepare_special_units)
(_default_format_contents), tp/Texinfo/Convert/IXIN.pm,
tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert),
tp/Texinfo/Convert/Plaintext.pm (_convert), tp/ext/epub3.pm,
tp/init/book.pm (book_convert_heading_command), tp/init/chm.pm
(chm_init): do not set 'sections_list', nstead use document
sections_list to get document sections list.
---
ChangeLog | 13 ++++++++++++
tp/Texinfo/Convert/Converter.pm | 3 ---
tp/Texinfo/Convert/HTML.pm | 45 +++++++++++++++++++++++++++++++----------
tp/Texinfo/Convert/IXIN.pm | 6 ++++--
tp/Texinfo/Convert/LaTeX.pm | 30 ++++++++++++++++++++-------
tp/Texinfo/Convert/Plaintext.pm | 18 +++++++++++++----
tp/ext/epub3.pm | 12 ++++++++---
tp/init/book.pm | 10 ++++++---
tp/init/chm.pm | 11 +++++++---
9 files changed, 112 insertions(+), 36 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2ac70af8d9..49838d97b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,19 @@
* tp/Texinfo/Common.pm (debug_print_tree): Also print 'unit_contents'
keys to allow printing an "output unit".
+2024-01-18 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Converter.pm (set_document),
+ tp/Texinfo/Convert/HTML.pm (_convert_heading_command)
+ (_convert_contents_command, _contents_shortcontents_in_title)
+ (_set_root_commands_targets_node_files, _prepare_special_units)
+ (_default_format_contents), tp/Texinfo/Convert/IXIN.pm,
+ tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert),
+ tp/Texinfo/Convert/Plaintext.pm (_convert), tp/ext/epub3.pm,
+ tp/init/book.pm (book_convert_heading_command), tp/init/chm.pm
+ (chm_init): do not set 'sections_list', nstead use document
+ sections_list to get document sections list.
+
2024-01-18 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Converter.pm (set_document),
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 43c8fbfce2..52c9aba966 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -266,13 +266,10 @@ sub set_document($$)
$converter->{'document'} = $document;
if (defined($document)) {
- my $floats = $document->floats_information();
my $identifier_target = $document->labels_information();
- my $sections_list = $document->sections_list();
$converter->{'identifiers_target'} = $identifier_target
if ($identifier_target);
- $converter->{'sections_list'} = $sections_list if ($sections_list);
$converter->{'indices_information'}
= $document->indices_information();
}
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 388de87972..f8216f3f7b 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2290,8 +2290,7 @@ sub get_file_information($$;$)
# information from converter available 'read-only', in general set up before
# really starting the formatting (except for current_filename).
-# 'sections_list' are set up in the generic
-# converter
+# 'document' is set up in the generic converter
my %available_converter_info;
foreach my $converter_info ('copying_comment', 'current_filename',
'destination_directory', 'document', 'document_name',
@@ -2299,7 +2298,6 @@ foreach my $converter_info ('copying_comment',
'current_filename',
'index_entries', 'index_entries_by_letter', 'indices_information',
'jslicenses', 'identifiers_target',
'line_break_element', 'non_breaking_space', 'paragraph_symbol',
- 'sections_list',
'simpletitle_command_name', 'simpletitle_tree',
'title_string', 'title_tree', 'title_titlepage') {
$available_converter_info{$converter_info} = 1;
@@ -4715,7 +4713,12 @@ sub _convert_heading_command($$$$$)
$element_header = &{$self->formatting_function('format_element_header')}(
$self, $cmdname, $element,
$output_unit);
}
- my $sections_list = $self->get_info('sections_list');
+
+ my $document = $self->get_info('document');
+ my $sections_list;
+ if ($document) {
+ $sections_list = $document->sections_list();
+ }
my $tables_of_contents = '';
if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_top'
@@ -6696,7 +6699,12 @@ sub _convert_contents_command($$$)
Texinfo::Common::set_informative_command_value($self, $command);
- my $sections_list = $self->get_info('sections_list');
+ my $document = $self->get_info('document');
+ my $sections_list;
+ if ($document) {
+ $sections_list = $document->sections_list();
+ }
+
if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'inline'
and ($cmdname eq 'contents' or $cmdname eq 'shortcontents')
and $self->get_conf($cmdname)
@@ -7879,7 +7887,12 @@ sub _contents_shortcontents_in_title($)
my $result = '';
- my $sections_list = $self->get_info('sections_list');
+ my $document = $self->get_info('document');
+ my $sections_list;
+ if ($document) {
+ $sections_list = $document->sections_list();
+ }
+
if ($sections_list
and scalar(@{$sections_list}) > 1
and $self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_title') {
@@ -9306,6 +9319,11 @@ sub _set_root_commands_targets_node_files($)
{
my $self = shift;
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
if ($self->{'identifiers_target'}) {
my $extension = '';
$extension = '.'.$self->get_conf('EXTENSION')
@@ -9350,8 +9368,8 @@ sub _set_root_commands_targets_node_files($)
}
}
- if ($self->{'sections_list'}) {
- foreach my $root_element (@{$self->{'sections_list'}}) {
+ if ($sections_list) {
+ foreach my $root_element (@{$sections_list}) {
$self->_new_sectioning_command_target($root_element);
}
}
@@ -9894,16 +9912,17 @@ sub _prepare_special_units($$)
my $output_units = shift;
my $global_commands;
+ my $sections_list;
if ($self->{'document'}) {
$global_commands = $self->{'document'}->global_commands_information();
+ $sections_list = $self->{'document'}->sections_list();
}
# for separate special output units
my %do_special;
# for associated special output units
my $associated_special_units = [];
- if ($self->{'sections_list'}
- and scalar(@{$self->{'sections_list'}}) > 1) {
+ if ($sections_list and scalar(@{$sections_list}) > 1) {
foreach my $cmdname ('shortcontents', 'contents') {
my $special_unit_variety
= $contents_command_special_unit_variety{$cmdname};
@@ -10600,7 +10619,11 @@ sub _default_format_contents($$;$$)
$filename = $self->get_info('current_filename') if (!defined($filename));
- my $sections_list = $self->get_info('sections_list');
+ my $document = $self->get_info('document');
+ my $sections_list;
+ if ($document) {
+ $sections_list = $document->sections_list();
+ }
return ''
if (!$sections_list or !scalar(@$sections_list));
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index d5a59b2e73..a29f3fbdb8 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -382,9 +382,11 @@ sub output_ixin($$)
my $document_info;
my $floats;
+ my $sections_list;
if ($self->->{'document'}) {
$document_info = $self->{'document'}->global_information();
$floats = $self->{'document'}->floats_information();
+ $sections_list = $self->{'document'}->sections_list();
}
if ($document_info and $document_info->{'dircategory_direntry'}) {
@@ -606,8 +608,8 @@ sub output_ixin($$)
# do sectioning tree
my $sectioning_tree = '';
$sectioning_tree .= $self->ixin_open_element('sectioningtree');
- if ($self->{'sections_list'}) {
- my $section_root = $self->{'sections_list'}->[0]
+ if ($sections_list) {
+ my $section_root = $sections_list->[0]
->{'extra'}->{'sectioning_root'};
foreach my $top_section (@{$section_root->{'extra'}->{'section_childs'}}) {
my $section = $top_section;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 91cf00bb45..efe94ea3a3 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -1857,14 +1857,20 @@ sub _begin_document($)
}
if ($global_commands and $global_commands->{'contents'}
- and $self->{'sections_list'}
and not (defined($self->get_conf('CONTENTS_OUTPUT_LOCATION'))
and $self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'inline')) {
- if ($global_commands->{'titlepage'}
- or $global_commands->{'shorttitlepage'}) {
- $result .= _set_headings($self, 'pagenum');
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
+ if ($sections_list) {
+ if ($global_commands->{'titlepage'}
+ or $global_commands->{'shorttitlepage'}) {
+ $result .= _set_headings($self, 'pagenum');
+ }
+ $result .= "\\tableofcontents\\newpage\n";
}
- $result .= "\\tableofcontents\\newpage\n";
}
if ($global_commands
@@ -4033,15 +4039,25 @@ sub _convert($$)
}
return $result;
} elsif ($cmdname eq 'contents') {
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
if (defined($self->get_conf('CONTENTS_OUTPUT_LOCATION'))
and $self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'inline'
- and $self->{'sections_list'}
+ and $sections_list
and not
$self->{'formatting_context'}->[-1]->{'in_skipped_node_top'}) {
$result .= "\\tableofcontents\\newpage\n";
}
return $result;
} elsif ($cmdname eq 'shortcontents' or $cmdname eq 'summarycontents') {
- if ($self->{'sections_list'}) {
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
+ if ($sections_list) {
# TODO see notes at the beginning
$result .= '';
}
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index fa71b2d63d..9397ffe03c 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -3304,16 +3304,26 @@ sub _convert($$)
}
return;
} elsif ($command eq 'contents') {
- if ($self->{'sections_list'}) {
- my $sectioning_root = $self->{'sections_list'}->[0]
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
+ if ($sections_list) {
+ my $sectioning_root = $sections_list->[0]
->{'extra'}->{'sectioning_root'};
$self->format_contents($sectioning_root, 'contents');
}
return;
} elsif ($command eq 'shortcontents'
or $command eq 'summarycontents') {
- if ($self->{'sections_list'}) {
- my $sectioning_root = $self->{'sections_list'}->[0]
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
+ if ($sections_list) {
+ my $sectioning_root = $sections_list->[0]
->{'extra'}->{'sectioning_root'};
$self->format_contents($sectioning_root, 'shortcontents');
}
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 6f5e538114..103cb9e0ed 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -655,7 +655,13 @@ EOT
my $nav_id = 'nav';
my $nav_file_path_name;
my $title = _epub_convert_tree_to_text($self, $self->get_info('title_tree'));
- if ($self->{'sections_list'}) {
+
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
+ if ($sections_list) {
$nav_file_path_name
= File::Spec->catfile($epub_document_destination_directory,
$nav_filename);
my ($encoded_nav_file_path_name, $nav_path_encoding)
@@ -686,7 +692,7 @@ EOT
EOT
# similar code as in chm.pm
- my $section_root = $self->{'sections_list'}->[0]
+ my $section_root = $sections_list->[0]
->{'extra'}->{'sectioning_root'};
my $upper_level = $section_root->{'extra'}->{'section_childs'}->[0]
->{'extra'}->{'section_level'};
@@ -697,7 +703,7 @@ EOT
$upper_level = 1 if ($upper_level <= 0);
my $root_level = $upper_level - 1;
my $level = $root_level;
- foreach my $section (@{$self->{'sections_list'}}) {
+ foreach my $section (@{$sections_list}) {
next if ($section->{'cmdname'} eq 'part');
my $section_level = $section->{'extra'}->{'section_level'};
$section_level = 1 if ($section_level == 0);
diff --git a/tp/init/book.pm b/tp/init/book.pm
index 8d72a833ed..d0def06940 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -210,11 +210,15 @@ sub book_convert_heading_command($$$$$)
$self, $cmdname, $element,
$output_unit);
}
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
my $tables_of_contents = '';
if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_top'
- and $cmdname eq 'top'
- and $self->{'sections_list'}
- and scalar(@{$self->{'sections_list'}}) > 1) {
+ and $cmdname eq 'top' and $sections_list
+ and scalar(@{$sections_list}) > 1) {
foreach my $content_command_name ('shortcontents', 'contents') {
if ($self->get_conf($content_command_name)) {
my $contents_text
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index e9fd253463..f1f175c0f9 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -314,8 +314,13 @@ sub chm_init($)
}
print $hhc_fh "</OBJECT>\n";
- if ($self->{'sections_list'}) {
- my $section_root = $self->{'sections_list'}->[0]
+ my $sections_list;
+ if ($self->{'document'}) {
+ $sections_list = $self->{'document'}->sections_list();
+ }
+
+ if ($sections_list) {
+ my $section_root = $sections_list->[0]
->{'extra'}->{'sectioning_root'};
my $upper_level = $section_root->{'extra'}->{'section_childs'}->[0]
->{'extra'}->{'section_level'};
@@ -326,7 +331,7 @@ sub chm_init($)
$upper_level = 1 if ($upper_level <= 0);
my $root_level = $upper_level - 1;
my $level = $root_level;
- foreach my $section (@{$self->{'sections_list'}}) {
+ foreach my $section (@{$sections_list}) {
next if ($section->{'cmdname'} eq 'part');
my $section_level = $section->{'extra'}->{'section_level'};
$section_level = 1 if ($section_level == 0);
- master updated (be96e0d57e -> 54faad841f), Patrice Dumas, 2024/01/18
- [no subject], Patrice Dumas, 2024/01/18
- [no subject], Patrice Dumas, 2024/01/18
- [no subject], Patrice Dumas, 2024/01/18
- [no subject],
Patrice Dumas <=
- [no subject], Patrice Dumas, 2024/01/18
- [no subject], Patrice Dumas, 2024/01/18
- [no subject], Patrice Dumas, 2024/01/18