texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo/tp Texinfo/Structuring.pm t/automatic_m...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Structuring.pm t/automatic_m...
Date: Mon, 16 Apr 2012 22:19:23 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/04/16 22:19:23

Modified files:
        tp/Texinfo     : Structuring.pm 
        tp/t           : automatic_menus.t do_master_menu.t 

Log message:
        Add empty line before @detailmenu and after an added menu.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.128&r2=1.129
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/automatic_menus.t?cvsroot=texinfo&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/do_master_menu.t?cvsroot=texinfo&r1=1.2&r2=1.3

Patches:
Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -b -r1.128 -r1.129
--- Texinfo/Structuring.pm      15 Apr 2012 22:34:31 -0000      1.128
+++ Texinfo/Structuring.pm      16 Apr 2012 22:19:23 -0000      1.129
@@ -1593,6 +1593,9 @@
         my $section = $node->{'extra'}->{'associated_section'};
         $current_menu = _new_block_command (address@hidden, $section, 'menu');
         push @{$section->{'contents'}}, $current_menu;
+        push @{$section->{'contents'}}, {'type' => 'empty_line',
+                                         'text' => "\n", 
+                                         'parent' => $section};
         push @{$node->{'menus'}}, $current_menu;
       } else {
         foreach my $entry (@pending) {
@@ -1728,12 +1731,33 @@
 
   my $last_menu = $top_node->{'menus'}->[-1];
   my $index = scalar(@{$last_menu->{'contents'}});
-  if (scalar(@{$last_menu->{'contents'}})
-      and $last_menu->{'contents'}->[-1]->{'cmdname'}
-      and $last_menu->{'contents'}->[-1]->{'cmdname'} eq 'end') {
+  if ($index
+      and $last_menu->{'contents'}->[$index-1]->{'cmdname'}
+      and $last_menu->{'contents'}->[$index-1]->{'cmdname'} eq 'end') {
     $index --;
   }
   $new_master_menu->{'parent'} = $last_menu;
+  if ($index
+      and $last_menu->{'contents'}->[$index-1]->{'type'}
+      and $last_menu->{'contents'}->[$index-1]->{'type'} eq 'menu_comment'
+      and $last_menu->{'contents'}->[$index-1]->{'contents'}->[-1]->{'type'}
+      and $last_menu->{'contents'}->[$index-1]->{'contents'}->[-1]->{'type'}
+             eq 'preformatted') {
+    my $empty_line = {'type' => 'empty_line', 'text' => "\n", 'parent' =>
+               $last_menu->{'contents'}->[$index-1]->{'contents'}->[-1]};
+    push @{$last_menu->{'contents'}->[$index-1]->{'contents'}}, $empty_line;
+  } elsif ($index
+           and $last_menu->{'contents'}->[$index-1]->{'type'}
+           and $last_menu->{'contents'}->[$index-1]->{'type'} eq 'menu_entry') 
{
+    my $menu_comment = {'type' => 'menu_comment', 'parent' => $last_menu};
+    splice (@{$last_menu->{'contents'}}, $index, 0, $menu_comment);
+    $index++;
+    my $preformatted = {'type' => 'preformatted', 'parent' => $menu_comment};
+    push @{$menu_comment->{'contents'}}, $preformatted;
+    my $empty_line = {'type' => 'after_description_line', 'text' => "\n",
+                      'parent' => $preformatted};
+    push @{$preformatted->{'contents'}}, $empty_line;
+  }
   splice (@{$last_menu->{'contents'}}, $index, 0, $new_master_menu);
 
   return 1;

Index: t/automatic_menus.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/automatic_menus.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/automatic_menus.t 25 Feb 2012 22:34:58 -0000      1.1
+++ t/automatic_menus.t 16 Apr 2012 22:19:23 -0000      1.2
@@ -45,6 +45,7 @@
 @menu
 * chap::
 @end menu
+
 @node chap
 @chapter chap
 ', 'simple');

Index: t/do_master_menu.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/do_master_menu.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/do_master_menu.t  26 Feb 2012 20:34:45 -0000      1.2
+++ t/do_master_menu.t  16 Apr 2012 22:19:23 -0000      1.3
@@ -175,5 +175,5 @@
 Texinfo::Structuring::regenerate_master_menu($parser);
 $out = Texinfo::Convert::Texinfo::convert($tree);
 
-is ($out, _get_in('',$reference), 'regenerate with no detailmenu');
+is ($out, _get_in('',"\n".$reference), 'regenerate with no detailmenu');
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]