texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Convert/HTML.pm t/resul...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Convert/HTML.pm t/resul...
Date: Sun, 06 Nov 2011 19:17:57 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/11/06 19:17:57

Modified files:
        tp             : TODO 
        tp/Texinfo/Convert: HTML.pm 
        tp/t/results/html_tests: shortcontents_no_top.pl 

Log message:
        Use a min and a max root level in contents/shortcontents formatting,
        one for the indentation, the other to determine if a command should
        be output in shortcontents.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.218&r2=1.219
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.204&r2=1.205
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/html_tests/shortcontents_no_top.pl?cvsroot=texinfo&r1=1.1&r2=1.2

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -b -r1.218 -r1.219
--- TODO        6 Nov 2011 17:48:54 -0000       1.218
+++ TODO        6 Nov 2011 19:17:57 -0000       1.219
@@ -5,9 +5,6 @@
 Before next release
 ===================
 
-html_tests/shortcontents_no_top the section level also appears in 
address@hidden
-
 
 Bugs
 ====

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -b -r1.204 -r1.205
--- Texinfo/Convert/HTML.pm     6 Nov 2011 00:55:28 -0000       1.204
+++ Texinfo/Convert/HTML.pm     6 Nov 2011 19:17:57 -0000       1.205
@@ -5590,11 +5590,17 @@
   my $contents;
   $contents = 1 if ($cmdname eq 'contents');
 
-  my $root_level = $section_root->{'section_childs'}->[0]->{'level'};
+  my $min_root_level = $section_root->{'section_childs'}->[0]->{'level'};
+  my $max_root_level = $section_root->{'section_childs'}->[0]->{'level'};
   foreach my $top_section(@{$section_root->{'section_childs'}}) {
-    $root_level = $top_section->{'level'}
-      if ($top_section->{'level'} < $root_level);
-  }
+    $min_root_level = $top_section->{'level'}
+      if ($top_section->{'level'} < $min_root_level);
+    $max_root_level = $top_section->{'level'}
+      if ($top_section->{'level'} > $max_root_level);
+  }
+  # chapter level elements are considered top-level here.
+  $max_root_level = 1 if ($max_root_level < 1);
+  #print STDERR "ROOT_LEVEL Max: $max_root_level, Min: $min_root_level\n";
   my $ul_class = '';
   $ul_class = $NO_BULLET_LIST_CLASS if ($self->get_conf('NUMBER_SECTIONS'));
 
@@ -5629,7 +5635,7 @@
         my $toc_id = $self->command_contents_id($section, $cmdname);
         if ($text ne '') {
           # no indenting for shortcontents
-          $result .= (' ' x (2*($section->{'level'} - $root_level))) 
+          $result .= (' ' x (2*($section->{'level'} - $min_root_level))) 
             if ($contents);
           if ($toc_id ne '' or $href ne '') {
             my $toc_name_attribute = '';
@@ -5649,12 +5655,11 @@
                and $toplevel_contents) {
         $result .= "<li>";
       }
-        
       # for shortcontents don't do child if child is not toplevel
       if ($section->{'section_childs'}
-          and ($contents or $section->{'level'} < $root_level+1)) {
+          and ($contents or $section->{'level'} < $max_root_level)) {
         # no indenting for shortcontents
-        $result .= "\n". ' ' x (2*($section->{'level'} - $root_level))
+        $result .= "\n". ' ' x (2*($section->{'level'} - $min_root_level))
           if ($contents);
         $result .= $self->_attribute_class('ul', $ul_class) .">\n";
         $section = $section->{'section_childs'}->[0];
@@ -5670,7 +5675,7 @@
         }
         while ($section->{'section_up'}) {
           $section = $section->{'section_up'};
-          $result .= "</li>\n". ' ' x (2*($section->{'level'} - $root_level))
+          $result .= "</li>\n". ' ' x (2*($section->{'level'} - 
$min_root_level))
             . "</ul>";
           if ($section eq $top_section) {
             $result .= "</li>\n" if ($toplevel_contents);

Index: t/results/html_tests/shortcontents_no_top.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/html_tests/shortcontents_no_top.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/html_tests/shortcontents_no_top.pl        6 Nov 2011 17:48:55 
-0000       1.1
+++ t/results/html_tests/shortcontents_no_top.pl        6 Nov 2011 19:17:57 
-0000       1.2
@@ -314,9 +314,7 @@
 <div class="shortcontents">
 <ul class="no-bullet">
 <li><a name="stoc-chap" href="#toc-chap">1 chap</a></li>
-<li><a name="stoc-chap2" href="#toc-chap2">2 chap2</a><ul class="no-bullet">
-<li><a name="stoc-sec" href="#toc-sec">2.1 sec</a></li>
-</ul></li>
+<li><a name="stoc-chap2" href="#toc-chap2">2 chap2</a></li>
 
 </ul>
 </div>



reply via email to

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