[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7498] menu entries in internal references array
From: |
gavinsmith0123 |
Subject: |
[7498] menu entries in internal references array |
Date: |
Sat, 5 Nov 2016 20:25:20 +0000 (UTC) |
Revision: 7498
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7498
Author: gavin
Date: 2016-11-05 20:25:20 +0000 (Sat, 05 Nov 2016)
Log Message:
-----------
menu entries in internal references array
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Parser.pm
trunk/tp/Texinfo/Structuring.pm
trunk/tp/t/automatic_menus.t
trunk/tp/t/do_master_menu.t
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2016-11-04 09:52:08 UTC (rev 7497)
+++ trunk/ChangeLog 2016-11-05 20:25:20 UTC (rev 7498)
@@ -1,3 +1,17 @@
+2016-11-05 Gavin Smith <address@hidden>
+
+ * tp/Texinfo/Parser.pm (_register_extra_menu_entry_information):
+ Delete 'normalized' value of 'menu_entry_node' hash.
+ (_enter_menu_entry_node): Add menu entry to 'internal_references'
+ array.
+ * tp/Texinfo/Structuring.pm (associate_internal_references):
+ Check for menu entries in the 'internal_references' array
+ and set 'normalized' on them. Shorten code by storing a
+ reference in a variable.
+ * t/automatic_menus.t, t/do_master_menu.t: Call
+ 'associate_internal_references' in order to have the 'normalized'
+ values set.
+
2016-11-04 Gavin Smith <address@hidden>
* tp/Texinfo/Parser.pm (_register_label): Remove exemption for
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2016-11-04 09:52:08 UTC (rev 7497)
+++ trunk/tp/Texinfo/Parser.pm 2016-11-05 20:25:20 UTC (rev 7498)
@@ -3522,6 +3522,7 @@
$self->line_error ($self->__("empty node name in menu entry"),
$line_nr);
}
} else {
+ delete $parsed_entry_node->{'normalized'};
$current->{'extra'}->{'menu_entry_node'} = $parsed_entry_node;
}
} elsif ($arg->{'type'} eq 'menu_entry_description') {
@@ -3541,6 +3542,8 @@
push @{$current->{'args'}}, $description;
_register_extra_menu_entry_information($self, $current, $line_nr);
$current->{'line_nr'} = $line_nr;
+ push @{$self->{'internal_references'}}, $current;
+
$current = $description;
push @{$current->{'contents'}}, {'type' => 'preformatted',
'parent' => $current,
Modified: trunk/tp/Texinfo/Structuring.pm
===================================================================
--- trunk/tp/Texinfo/Structuring.pm 2016-11-04 09:52:08 UTC (rev 7497)
+++ trunk/tp/Texinfo/Structuring.pm 2016-11-05 20:25:20 UTC (rev 7498)
@@ -1154,24 +1154,43 @@
my $refs = $self->internal_references_information();
return if (!defined($refs));
foreach my $ref (@$refs) {
- if (!defined($labels->{$ref->{'extra'}{'node_argument'}{'normalized'}})) {
+ my $node_arg;
+ $node_arg = $ref->{'extra'}{'menu_entry_node'};
+
+ if (defined $node_arg) {
+ if ($node_arg->{'node_content'}) {
+ my $normalized =
+ Texinfo::Convert::NodeNameNormalization::normalize_node(
+ {'contents' => $node_arg->{'node_content'} });
+ $node_arg->{'normalized'} = $normalized
+ if (defined $normalized and $normalized ne '');
+ }
+ next;
+ }
+
+ $node_arg = $ref->{'extra'}{'node_argument'};
+ if ($node_arg->{'node_content'}) {
+ my $normalized =
+ Texinfo::Convert::NodeNameNormalization::normalize_node(
+ {'contents' => $node_arg->{'node_content'} });
+ $node_arg->{'normalized'} = $normalized
+ if (defined $normalized and $normalized ne '');
+ }
+ if (!defined($labels->{$node_arg->{'normalized'}})) {
if (!$self->{'info'}->{'novalidate'}) {
$self->line_error(sprintf($self->__("address@hidden reference to
nonexistent node `%s'"),
- $ref->{'cmdname'},
- node_extra_to_texi($ref->{'extra'}->{'node_argument'})),
- $ref->{'line_nr'})
+ $ref->{'cmdname'}, node_extra_to_texi($node_arg)),
+ $ref->{'line_nr'});
}
} else {
- my $node_target
- = $labels->{$ref->{'extra'}->{'node_argument'}->{'normalized'}};
+ my $node_target = $labels->{$node_arg->{'normalized'}};
$ref->{'extra'}->{'label'} = $node_target;
if (!$self->{'info'}->{'novalidate'}
- and !_check_node_same_texinfo_code($node_target,
- $ref->{'extra'}->{'node_argument'})) {
+ and !_check_node_same_texinfo_code($node_target, $node_arg)) {
$self->line_warn(sprintf($self->
__("address@hidden to `%s', different from %s name `%s'"),
$ref->{'cmdname'},
- node_extra_to_texi($ref->{'extra'}->{'node_argument'}),
+ node_extra_to_texi($node_arg),
$node_target->{'cmdname'},
node_extra_to_texi($node_target->{'extra'})), $ref->{'line_nr'});
}
Modified: trunk/tp/t/automatic_menus.t
===================================================================
--- trunk/tp/t/automatic_menus.t 2016-11-04 09:52:08 UTC (rev 7497)
+++ trunk/tp/t/automatic_menus.t 2016-11-05 20:25:20 UTC (rev 7498)
@@ -30,6 +30,7 @@
my $parser = Texinfo::Parser::parser();
my $tree = $parser->parse_texi_text($in);
+ $parser->Texinfo::Structuring::associate_internal_references();
my $sectioning = $parser->Texinfo::Structuring::sectioning_structure($tree);
$parser->Texinfo::Transformations::complete_tree_nodes_menus($tree);
my $texi_result = Texinfo::Convert::Texinfo::convert($tree);
Modified: trunk/tp/t/do_master_menu.t
===================================================================
--- trunk/tp/t/do_master_menu.t 2016-11-04 09:52:08 UTC (rev 7497)
+++ trunk/tp/t/do_master_menu.t 2016-11-05 20:25:20 UTC (rev 7498)
@@ -130,6 +130,7 @@
my $parser = Texinfo::Parser::parser();
my $tree = $parser->parse_texi_text($in_detailmenu);
+Texinfo::Structuring::associate_internal_references($parser);
my $master_menu = Texinfo::Transformations::new_master_menu($parser);
my $out = Texinfo::Convert::Texinfo::convert($master_menu);
@@ -169,12 +170,14 @@
$parser = Texinfo::Parser::parser();
$tree = $parser->parse_texi_text($no_detailmenu);
+Texinfo::Structuring::associate_internal_references($parser);
$master_menu = Texinfo::Transformations::new_master_menu($parser);
$out = Texinfo::Convert::Texinfo::convert($master_menu);
is ($out, $reference, 'master menu no detailmenu');
$parser = Texinfo::Parser::parser();
$tree = $parser->parse_texi_text($in_detailmenu);
+Texinfo::Structuring::associate_internal_references($parser);
Texinfo::Transformations::regenerate_master_menu($parser);
$out = Texinfo::Convert::Texinfo::convert($tree);
@@ -184,6 +187,7 @@
$parser = Texinfo::Parser::parser();
$tree = $parser->parse_texi_text($no_detailmenu);
+Texinfo::Structuring::associate_internal_references($parser);
Texinfo::Transformations::regenerate_master_menu($parser);
$out = Texinfo::Convert::Texinfo::convert($tree);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7498] menu entries in internal references array,
gavinsmith0123 <=