[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Structuring.pm (no_root_command_tree
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Structuring.pm (no_root_command_tree), tp/Texinfo/Transformations.pm (fill_gaps_in_sectioning) (insert_nodes_for_sectioning_commands) (_get_non_automatic_nodes_with_sections): do not use no_root_command_tree, instead inspect the contents directly. Remove no_root_command_tree(). |
Date: |
Fri, 31 Dec 2021 06:04:12 -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 f0ea99471f * tp/Texinfo/Structuring.pm (no_root_command_tree),
tp/Texinfo/Transformations.pm (fill_gaps_in_sectioning)
(insert_nodes_for_sectioning_commands)
(_get_non_automatic_nodes_with_sections): do not use no_root_command_tree,
instead inspect the contents directly. Remove no_root_command_tree().
f0ea99471f is described below
commit f0ea99471fe72f5a6669f0df6f6a854a2703e672
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 31 12:04:01 2021 +0100
* tp/Texinfo/Structuring.pm (no_root_command_tree),
tp/Texinfo/Transformations.pm (fill_gaps_in_sectioning)
(insert_nodes_for_sectioning_commands)
(_get_non_automatic_nodes_with_sections): do not use
no_root_command_tree, instead inspect the contents directly.
Remove no_root_command_tree().
* tp/Texinfo/Structuring.pm (split_by_section): explicitly select
root commands for sections (which are not nodes).
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/Structuring.pm | 20 +-------------------
tp/Texinfo/Transformations.pm | 19 ++-----------------
3 files changed, 15 insertions(+), 36 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 357333f2fb..de4bb3a2cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2021-12-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Structuring.pm (no_root_command_tree),
+ tp/Texinfo/Transformations.pm (fill_gaps_in_sectioning)
+ (insert_nodes_for_sectioning_commands)
+ (_get_non_automatic_nodes_with_sections): do not use
+ no_root_command_tree, instead inspect the contents directly.
+ Remove no_root_command_tree().
+
+ * tp/Texinfo/Structuring.pm (split_by_section): explicitly select
+ root commands for sections (which are not nodes).
+
2021-12-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_convert_tree_unit_type, convert)
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 284ccc4c01..dd22de4944 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -114,23 +114,6 @@ sub section_level($)
}
-sub no_root_command_tree($)
-{
- my $root = shift;
- if (!$root->{'type'} or $root->{'type'} ne 'document_root'
- or !$root->{'contents'}
- or scalar(@{$root->{'contents'}}) == 0
- or ($root->{'contents'}->[0]->{'type'}
- and $root->{'contents'}->[0]->{'type'} eq 'text_root'
- and (scalar(@{$root->{'contents'}}) == 1
- or (scalar(@{$root->{'contents'}}) == 2
- and $root->{'contents'}->[1]->{'cmdname'}
- and $root->{'contents'}->[1]->{'cmdname'} eq 'bye')))) {
- return 1;
- }
- return 0;
-}
-
# Go through the sectioning commands (e.g. @chapter, not @node), and
# set:
# 'number'
@@ -920,8 +903,7 @@ sub split_by_section($)
push @$tree_units, $current;
}
} elsif ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
- and $content->{'cmdname'} ne 'bye') {
- # FIXME check that it is a sectioning command?
+ and $Texinfo::Common::root_commands{$content->{'cmdname'}}) {
if (not defined($current->{'extra'})
or not defined($current->{'extra'}->{'section'})) {
$current->{'extra'}->{'section'} = $content;
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 5a282e9d45..93ed4c4dd6 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -73,13 +73,10 @@ sub _correct_level($$;$)
sub fill_gaps_in_sectioning($)
{
my $root = shift;
- if (Texinfo::Structuring::no_root_command_tree($root)) {
- return undef;
- }
my @sections_list;
foreach my $content (@{$root->{'contents'}}) {
if ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
- and $content->{'cmdname'} ne 'bye') {
+ and $Texinfo::Common::root_commands{$content->{'cmdname'}}) {
push @sections_list, $content;
}
}
@@ -324,16 +321,13 @@ sub insert_nodes_for_sectioning_commands($$$$)
my $targets_list = shift;
my $labels = shift;
- if (Texinfo::Structuring::no_root_command_tree($root)) {
- return (undef, undef);
- }
my @added_nodes;
my @contents;
my $previous_node;
foreach my $content (@{$root->{'contents'}}) {
if ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
- and $content->{'cmdname'} ne 'bye'
and $content->{'cmdname'} ne 'part'
+ and $Texinfo::Common::root_commands{$content->{'cmdname'}}
and not ($content->{'extra'}
and $content->{'extra'}->{'associated_node'})) {
my $new_node_tree;
@@ -457,9 +451,6 @@ sub _get_non_automatic_nodes_with_sections($)
{
my $root = shift;
- if (Texinfo::Structuring::no_root_command_tree($root)) {
- return undef;
- }
my @non_automatic_nodes;
foreach my $content (@{$root->{'contents'}}) {
if ($content->{'cmdname'} and $content->{'cmdname'} eq 'node'
@@ -479,9 +470,6 @@ sub complete_tree_nodes_menus($;$)
my $use_sections = shift;
my $non_automatic_nodes = _get_non_automatic_nodes_with_sections($root);
- if (not defined($non_automatic_nodes)) {
- return undef;
- }
foreach my $node (@{$non_automatic_nodes}) {
complete_node_menu($node, $use_sections);
}
@@ -494,9 +482,6 @@ sub complete_tree_nodes_missing_menu($;$)
my $use_sections = shift;
my $non_automatic_nodes = _get_non_automatic_nodes_with_sections($root);
- if (not defined($non_automatic_nodes)) {
- return undef;
- }
foreach my $node (@{$non_automatic_nodes}) {
if (not $node->{'menus'} or not scalar(@{$node->{'menus'}})) {
my $section = $node->{'extra'}->{'associated_section'};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Structuring.pm (no_root_command_tree), tp/Texinfo/Transformations.pm (fill_gaps_in_sectioning) (insert_nodes_for_sectioning_commands) (_get_non_automatic_nodes_with_sections): do not use no_root_command_tree, instead inspect the contents directly. Remove no_root_command_tree().,
Patrice Dumas <=