[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc... |
Date: |
Mon, 21 Jan 2013 21:00:18 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 13/01/21 21:00:18
Modified files:
tp : TODO
tp/Texinfo : Parser.pm Structuring.pm
tp/t : do_master_menu.t
Log message:
Recursively print sub menus when redoing a master menu.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.307&r2=1.308
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.412&r2=1.413
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.141&r2=1.142
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/do_master_menu.t?cvsroot=texinfo&r1=1.3&r2=1.4
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.307
retrieving revision 1.308
diff -u -b -r1.307 -r1.308
--- TODO 11 Nov 2012 20:12:23 -0000 1.307
+++ TODO 21 Jan 2013 21:00:17 -0000 1.308
@@ -14,6 +14,15 @@
===================
+New stack for inlineraw and rawpreformatted to now whether currently
+in an ignored raw format. Then
+* entering index entry
+* anchors
+* floats
+* abbrev/acronym
+* misc commands
+should not have an effect if in such cases
+
Bugs
====
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.412
retrieving revision 1.413
diff -u -b -r1.412 -r1.413
--- Texinfo/Parser.pm 21 Jan 2013 00:42:57 -0000 1.412
+++ Texinfo/Parser.pm 21 Jan 2013 21:00:17 -0000 1.413
@@ -145,9 +145,11 @@
# 'preformatted' is added in block commands
# where there is no paragraphs and spaces are kept
# (format, example, display...)
+# 'rawpreformatted' is added in raw block commands
+# (html, xml, docbook...)
# 'menu' is added in menu commands
-# 'math', 'footnote', 'caption', 'shortcaption' are
-# also added when in those commands
+# 'math', 'footnote', 'caption', 'shortcaption',
+# 'inlineraw' are also added when in those commands
# conditionals_stack a stack of conditional commands that are expanded.
# macro_stack stack of macros being expanded (more recent first)
# definfoenclose an hash, key is the command name, value is an array
@@ -4847,7 +4849,7 @@
}
} elsif ($separator eq '}') {
- _abort_empty_line ($self, $current);
+ _abort_empty_line($self, $current);
#print STDERR "GGGGG". _print_current ($current);
if ($current->{'type'} and ($current->{'type'} eq 'bracketed')) {
$current = $current->{'parent'};
Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -b -r1.141 -r1.142
--- Texinfo/Structuring.pm 18 Dec 2012 23:38:29 -0000 1.141
+++ Texinfo/Structuring.pm 21 Jan 2013 21:00:18 -0000 1.142
@@ -1719,33 +1719,36 @@
}
}
-sub new_master_menu($;$)
+sub _print_down_menus($$;$);
+sub _print_down_menus($$;$)
{
my $self = shift;
+ my $node = shift;
my $labels = shift;
$labels = $self->labels_information() if (!defined($labels));
- my $top_node = $labels->{'Top'};
- return undef if (!defined($top_node));
- my @first_level_nodes;
- if ($top_node->{'menus'} and scalar(@{$top_node->{'menus'}})) {
- foreach my $menu (@{$top_node->{'menus'}}) {
+ my @master_menu_contents;
+
+ if ($node->{'menus'} and scalar(@{$node->{'menus'}})) {
+ my @node_children;
+ foreach my $menu (@{$node->{'menus'}}) {
foreach my $entry (@{$menu->{'contents'}}) {
if ($entry->{'type'} and $entry->{'type'} eq 'menu_entry') {
+ push @master_menu_contents, Texinfo::Common::copy_tree($entry);
+ # gather node cheldren to recusrsively print their menus
my $entry_node = $entry->{'extra'}->{'menu_entry_node'};
if (! $entry_node->{'manual_content'}
and defined($entry_node->{'normalized'})) {
- push @first_level_nodes, $entry_node->{'normalized'};
+ my $node = $labels->{$entry_node->{'normalized'}};
+ if (defined($node) and $node->{'extra'}) {
+ push @node_children, $node;
}
}
}
}
}
-
- my @master_menu_contents;
- foreach my $normalized_node (@first_level_nodes) {
- my $node = $labels->{$normalized_node};
- next if (!defined($node) or !$node->{'extra'});
+ if (scalar(@master_menu_contents)) {
+ # Prepend node title
my $node_title_contents;
if ($node->{'extra'}->{'associated_section'}
and $node->{'extra'}->{'associated_section'}->{'extra'}
@@ -1766,17 +1769,44 @@
foreach my $content (@{$menu_comment->{'contents'}->[0]->{'contents'}}) {
$content->{'parent'} = $menu_comment->{'contents'}->[0];
}
- push @master_menu_contents, $menu_comment;
- if ($node->{'menus'}) {
+ unshift @master_menu_contents, $menu_comment;
+
+ # now recurse in the children
+ foreach my $child (@node_children) {
+ push @master_menu_contents, _print_down_menus($self, $child, $labels);
+ }
+ }
+ }
+ return @master_menu_contents;
+}
+
+sub new_master_menu($;$)
+{
+ my $self = shift;
+ my $labels = shift;
+ $labels = $self->labels_information() if (!defined($labels));
+ my $node = $labels->{'Top'};
+ return undef if (!defined($node));
+
+ my @master_menu_contents;
+ if ($node->{'menus'} and scalar(@{$node->{'menus'}})) {
foreach my $menu (@{$node->{'menus'}}) {
foreach my $entry (@{$menu->{'contents'}}) {
if ($entry->{'type'} and $entry->{'type'} eq 'menu_entry') {
- push @master_menu_contents, Texinfo::Common::copy_tree($entry);
+ my $entry_node = $entry->{'extra'}->{'menu_entry_node'};
+ if (! $entry_node->{'manual_content'}
+ and defined($entry_node->{'normalized'})) {
+ my $node = $labels->{$entry_node->{'normalized'}};
+ if (defined($node) and $node->{'extra'}) {
+ push @master_menu_contents, _print_down_menus($self,
+ $node, $labels);
}
}
}
}
}
+ }
+ if (scalar(@master_menu_contents)) {
my $first_preformatted = $master_menu_contents[0]->{'contents'}->[0];
my $master_menu_title = $self->gdt(' --- The Detailed Node Listing ---');
my @master_menu_title_contents;
@@ -1786,6 +1816,9 @@
}
unshift @{$first_preformatted->{'contents'}}, @master_menu_title_contents;
return _new_block_command(address@hidden, undef, 'detailmenu');
+ } else {
+ return undef;
+ }
}
sub regenerate_master_menu($;$)
Index: t/do_master_menu.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/do_master_menu.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- t/do_master_menu.t 16 Apr 2012 22:19:23 -0000 1.3
+++ t/do_master_menu.t 21 Jan 2013 21:00:18 -0000 1.4
@@ -135,6 +135,10 @@
GGG
* label: sec2. D2
+sec0
+
+* subsec::
+
chapter @code{in code} 2
* sec 2-0::
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc...,
Patrice Dumas <=