[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 18 Apr 2022 15:51:29 -0400 (EDT) |
branch: master
commit 8a5cc664d049cdeb417a4fe4dd437b990d51388e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 18 21:37:29 2022 +0200
* tp/Texinfo/Structuring.pm (new_node_menu_entry)
(new_complete_node_menu): handle node with {'extra'}->{'node_content'}
undef, as happens for node with empty argument.
---
ChangeLog | 6 ++++++
tp/Makefile.am | 1 +
tp/Texinfo/Structuring.pm | 8 ++++++--
tp/t/30sectioning.t | 2 ++
tp/t/input_files/only_special_spaces_node.texi | 24 ++++++++++++++++++++++++
5 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 37b5bb96bf..9a554b0e5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,12 @@
carriage return. The code is somewhat hard to follow and it
should be unlikely that a carriage return makes it to this code.
+2022-04-18 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Structuring.pm (new_node_menu_entry)
+ (new_complete_node_menu): handle node with {'extra'}->{'node_content'}
+ undef, as happens for node with empty argument.
+
2022-04-18 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/ParagraphNonXS.pm (add_text): consider \r
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 5a3b317f4c..9801ce1aa6 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -220,6 +220,7 @@ test_files = \
t/input_files/non_break_spaces.texi \
t/input_files/one_line.texi \
t/input_files/one_line_no_content.texi \
+ t/input_files/only_special_spaces_node.texi \
t/input_files/placed_things_before_element.texi \
t/input_files/punctuation_small_case_accents_latin1.texi \
t/input_files/punctuation_small_case_accents_us_ascii.texi \
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 92e9f2f7c1..1e1d61dc43 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1422,6 +1422,9 @@ sub new_node_menu_entry
my ($node, $use_sections) = @_;
my $node_contents = $node->{'extra'}->{'node_content'};
+
+ # can happen with node without argument or with empty argument
+ return undef if (not defined($node_contents));
my ($name_contents, $menu_entry_name);
if ($use_sections) {
@@ -1533,9 +1536,9 @@ sub new_complete_node_menu
}
my @pending;
- for my $child (@node_childs) {
+ foreach my $child (@node_childs) {
my $entry = new_node_menu_entry($child, $use_sections);
- push @pending, $entry;
+ push @pending, $entry if defined($entry);
}
my $section = $node->{'extra'}->{'associated_section'};
@@ -1952,6 +1955,7 @@ X<C<new_node_menu_entry>>
Returns the texinfo tree corresponding to a single menu entry pointing to
I<$node>. If I<$use_sections> is set, use the section name instead of node
name.
+Returns C<undef> if the node argument is missing.
=item $top_node = nodes_tree($registrar, $configuration_information,
$parser_information, $nodes_list, $labels)
X<C<nodes_tree>>
diff --git a/tp/t/30sectioning.t b/tp/t/30sectioning.t
index 607ee21392..60e6aae5bc 100644
--- a/tp/t/30sectioning.t
+++ b/tp/t/30sectioning.t
@@ -610,6 +610,8 @@ $character_and_spaces_in_refs_text],
'],
['special_spaces_in_nodes',
undef, {'test_file' => 'special_spaces_in_nodes.texi'}],
+['only_special_spaces_node',
+undef, {'test_file' => 'only_special_spaces_node.texi'}],
['double_node_anchor_float',
'@node node1
diff --git a/tp/t/input_files/only_special_spaces_node.texi
b/tp/t/input_files/only_special_spaces_node.texi
new file mode 100644
index 0000000000..8247119a29
--- /dev/null
+++ b/tp/t/input_files/only_special_spaces_node.texi
@@ -0,0 +1,24 @@
+
+@node Top
+@top top
+
+@node
+@chapter EN QUAD| | EM QUAD| | EN SPACE| |
+
+@node
+@chapter CHARACTER TABULATION| | FORM FEED|| LINE TABULATION||
+
+@node
+@chapter CARRIAGE RETURN|
|
+
+@node
+@chapter NEXT LINE (NEL)|
| NO-BREAK SPACE| | OGHAM SPACE MARK| |
+
+@node
+@chapter MONGOLIAN VOWEL SEPARATOR|| EM SPACE| |
+
+@node
+
+@chapter THREE-PER-EM SPACE| | FOUR-PER-EM SPACE| | SIX-PER-EM SPACE| | FIGURE
SPACE| | PUNCTUATION SPACE| | THIN SPACE| | HAIR SPACE| | LINE SEPARATOR|
|
PARAGRAPH SEPARATOR|
| NARROW NO-BREAK SPACE| | MEDIUM MATHEMATICAL SPACE| |
IDEOGRAPHIC SPACE| |
+
+@bye