[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8030] parsetexi find node menus differently
From: |
gavinsmith0123 |
Subject: |
[8030] parsetexi find node menus differently |
Date: |
Thu, 9 Aug 2018 11:39:15 -0400 (EDT) |
Revision: 8030
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8030
Author: gavin
Date: 2018-08-09 11:39:15 -0400 (Thu, 09 Aug 2018)
Log Message:
-----------
parsetexi find node menus differently
Modified Paths:
--------------
trunk/tp/parsetexi/Parsetexi.pm
Modified: trunk/tp/parsetexi/Parsetexi.pm
===================================================================
--- trunk/tp/parsetexi/Parsetexi.pm 2018-08-09 13:44:11 UTC (rev 8029)
+++ trunk/tp/parsetexi/Parsetexi.pm 2018-08-09 15:39:15 UTC (rev 8030)
@@ -211,26 +211,13 @@
use Data::Dumper;
-# Look for a menu in the node, saving in the 'menus' array reference
-# of the node element
-# This array was built on line 4800 of Parser.pm.
-sub _find_menus_of_node ($) {
+# Record any @menu elements under $root in the 'menus' array of $node.
+sub _find_menus_of_node {
my $node = shift;
+ my $root = shift;
- # If a sectioning command wasn't used in the node, the
- # associated_section won't be set. This is the case for
- # "(texinfo)Info Format Preamble" and some other nodes in
- # doc/texinfo.texi. Avoid referencing it which would create
- # it by mistake, which would cause problems in Structuring.pm.
- #
- # Also, check for menu elements under both the node element and the
- # sectioning element. This is for malformed input with a @menu between
- # the two commands.
-
- my $contents;
-
- if ($node->{'contents'}) {
- $contents = $node->{'contents'};
+ if ($root->{'contents'}) {
+ my $contents = $root->{'contents'};
foreach my $child (@{$contents}) {
if ($child->{'cmdname'} and $child->{'cmdname'} eq 'menu') {
push @{$node->{'menus'}}, $child;
@@ -237,19 +224,11 @@
}
}
}
-
- if (defined $node->{'extra'}{'associated_section'}) {
- $contents = $node->{'extra'}{'associated_section'}->{'contents'};
- foreach my $child (@{$contents}) {
- if ($child->{'cmdname'} and $child->{'cmdname'} eq 'menu') {
- push @{$node->{'menus'}}, $child;
- }
- }
- }
}
-# For each node, call _find_menus_of_node.
-sub _complete_node_menus ($$) {
+# Set 'menus' array for each node. This accounts for malformed input where
+# the number of sectioning commands between @node and @menu is not exactly 1.
+sub _complete_node_menus {
my $self = shift;
my $root = shift;
@@ -256,10 +235,12 @@
if (!defined $self->{'nodes'}) {
$self->{'nodes'} = [];
}
+ my $node;
foreach my $child (@{$root->{'contents'}}) {
if ($child->{'cmdname'} and $child->{'cmdname'} eq 'node') {
- _find_menus_of_node ($child);
+ $node = $child;
}
+ _find_menus_of_node ($node, $child) unless !defined $node;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [8030] parsetexi find node menus differently,
gavinsmith0123 <=