texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_co


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_command) (_default_format_heading_text, _default_format_titlepage) (_convert_titlefont_command, _print_title), tp/init/book.pm: add a an $additional_classes argument for _default_format_heading_text, and change argument order such that the element argument which is not used, is last. Do not set an element argument in calls to format_heading_text except for the call from _convert_heading_command.
Date: Wed, 12 Jan 2022 06:18:45 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ef56fb41c3 * tp/Texinfo/Convert/HTML.pm (_convert_heading_command) 
(_default_format_heading_text, _default_format_titlepage) 
(_convert_titlefont_command, _print_title), tp/init/book.pm: add a an 
$additional_classes argument for _default_format_heading_text, and change 
argument order such that the element argument which is not used, is last.  Do 
not set an element argument in calls to format_heading_text except for the call 
from _convert_heading_command.
ef56fb41c3 is described below

commit ef56fb41c394b389ebac886d9a8f77c3f6d311af
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jan 12 12:18:35 2022 +0100

    * tp/Texinfo/Convert/HTML.pm (_convert_heading_command)
    (_default_format_heading_text, _default_format_titlepage)
    (_convert_titlefont_command, _print_title), tp/init/book.pm: add
    a an $additional_classes argument for _default_format_heading_text,
    and change argument order such that the element argument which is not
    used, is last.  Do not set an element argument in calls to
    format_heading_text except for the call from _convert_heading_command.
---
 ChangeLog                                          | 10 +++++++++
 tp/Texinfo/Convert/HTML.pm                         | 24 ++++++++++++----------
 tp/init/book.pm                                    |  2 +-
 .../moreindices/index_no_node/res_html/index.html  |  2 +-
 tp/t/results/sectioning/part_before_section.pl     |  2 +-
 .../sectioning/section_before_after_top_node.pl    |  2 +-
 .../section_before_after_top_node_last_node.pl     |  2 +-
 tp/t/results/sectioning/section_before_top.pl      |  2 +-
 .../sectioning/section_chapter_before_top_nodes.pl |  4 ++--
 .../sectioning/unnumbered_before_node_top_top.pl   |  2 +-
 .../unnumbered_top_without_node_nodes.pl           |  2 +-
 .../unnumbered_top_without_node_sections.pl        |  2 +-
 12 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2cfdaf1544..c259dd394d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-01-11  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_convert_heading_command)
+       (_default_format_heading_text, _default_format_titlepage)
+       (_convert_titlefont_command, _print_title), tp/init/book.pm: add
+       a an $additional_classes argument for _default_format_heading_text,
+       and change argument order such that the element argument which is not
+       used, is last.  Do not set an element argument in calls to
+       format_heading_text except for the call from _convert_heading_command.
+
 2022-01-11  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_heading_command): use
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 108baf9207..d0b37fcb69 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2695,7 +2695,7 @@ sub _convert_titlefont_command($$$$)
     return '';
   }
   return &{$self->{'format_heading_text'}}($self, $cmdname, $cmdname,
-                                           $text, 0, $command);
+                                           $text, 0);
 }
 $default_commands_conversion{'titlefont'} = \&_convert_titlefont_command;
 
@@ -2748,15 +2748,16 @@ sub _default_css_string_format_protect_text($$) {
 
 # can be called on root commands, tree units, special elements
 # and title elements.  $cmdname can be undef for special elements.
-sub _default_format_heading_text($$$$$$;$)
+sub _default_format_heading_text($$$$$;$$$)
 {
   my $self = shift;
   my $cmdname = shift;
   my $class = shift;
   my $text = shift;
   my $level = shift;
-  my $element = shift;
   my $id = shift;
+  my $additional_classes = shift;
+  my $element = shift;
 
   return '' if ($text !~ /\S/ and not defined($id));
 
@@ -2775,7 +2776,7 @@ sub _default_format_heading_text($$$$$$;$)
   if (defined($id)) {
     $id_str = " id=\"$id\"";
   }
-  my $result = $self->html_attribute_class("h$level", $class)
+  my $result = $self->html_attribute_class("h$level", $class, 
$additional_classes)
                     ."${id_str}>$text</h$level>";
   # titlefont appears inline in text, so no end of line is
   # added. The end of line should be added by the user if needed.
@@ -3271,11 +3272,16 @@ sub _convert_heading_command($$$$$)
 
   my $element_id = $self->command_id($element);
 
+  my @additional_heading_classes;
   my $level_corrected_cmdname = $cmdname;
   if (defined $element->{'structure'}->{'section_level'}) {
     # if the level was changed, use a consistent command name
     $level_corrected_cmdname
       = Texinfo::Structuring::section_level_adjusted_command_name($element);
+    if ($level_corrected_cmdname ne $cmdname) {
+      push @additional_heading_classes,
+            "${cmdname}-level-set-${level_corrected_cmdname}";
+    }
   }
 
   # find the section starting here, can be through the associated node
@@ -3398,7 +3404,7 @@ sub _convert_heading_command($$$$$)
       $result .= &{$self->{'format_heading_text'}}($self,
                      $level_corrected_cmdname, $heading_class, $heading,
                      $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') 
-1,
-                     $element, $heading_id);
+                     $heading_id, \@additional_heading_classes, $element);
     }
   } elsif (defined($heading_id)) {
     # case of a lone node and no header, and case of an empty @top
@@ -5721,9 +5727,7 @@ sub _default_format_titlepage($)
      $self->{'simpletitle_tree'}, "$self->{'simpletitle_command_name'} 
simpletitle");
     $titlepage_text = &{$self->{'format_heading_text'}}($self,
                   $self->{'simpletitle_command_name'},
-                  $self->{'simpletitle_command_name'}, $title_text,
-                  0, {'cmdname' => $self->{'simpletitle_command_name'},
-                      'contents' => 
$self->{'simpletitle_tree'}->{'contents'}});
+                  $self->{'simpletitle_command_name'}, $title_text, 0);
   }
   my $result = '';
   $result .= $titlepage_text.$self->get_conf('DEFAULT_RULE')."\n"
@@ -5746,9 +5750,7 @@ sub _print_title($)
          $self->{'simpletitle_tree'}, "$self->{'simpletitle_command_name'} 
simpletitle");
         $result .= &{$self->{'format_heading_text'}}($self,
                   $self->{'simpletitle_command_name'},
-                  $self->{'simpletitle_command_name'}, $title_text,
-                  0, {'cmdname' => $self->{'simpletitle_command_name'},
-                      'contents' => 
$self->{'simpletitle_tree'}->{'contents'}});
+                  $self->{'simpletitle_command_name'}, $title_text, 0);
       }
       $result .= $self->_contents_shortcontents_in_title();
     }
diff --git a/tp/init/book.pm b/tp/init/book.pm
index f79111f6c4..85f6bb59d3 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -278,7 +278,7 @@ sub book_convert_heading_command($$$$$)
       $result .= &{$self->{'format_heading_text'}}($self,
                      $level_corrected_cmdname, $heading_class, $heading,
                      $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') 
-1,
-                     $element, $heading_id);
+                     $heading_id);
     }
   } elsif (defined($heading_id)) {
     # case of a lone node and no header, and case of an empty @top
diff --git a/tp/t/results/moreindices/index_no_node/res_html/index.html 
b/tp/t/results/moreindices/index_no_node/res_html/index.html
index 42e20f4deb..aa22b57551 100644
--- a/tp/t/results/moreindices/index_no_node/res_html/index.html
+++ b/tp/t/results/moreindices/index_no_node/res_html/index.html
@@ -32,7 +32,7 @@ span.program-in-footer {font-size: smaller}
 <td valign="middle" align="left">[<a href="unnumbered.html" 
title="Index">Index</a>]</td>
 <td valign="middle" align="left">[<a href="index_no_node_abt.html#SEC_About" 
title="About (help)"> ? </a>]</td>
 </tr></table>
-<h1 class="unnumbered">top section</h1>
+<h1 class="unnumbered top-level-set-unnumbered">top section</h1>
 
 <a class="index-entry-id" id="index-top-section"></a>
 <a class="index-entry-id" id="index-top-section-1"></a>
diff --git a/tp/t/results/sectioning/part_before_section.pl 
b/tp/t/results/sectioning/part_before_section.pl
index ab8da936ce..607acafd0a 100644
--- a/tp/t/results/sectioning/part_before_section.pl
+++ b/tp/t/results/sectioning/part_before_section.pl
@@ -232,7 +232,7 @@ $result_converted{'html_text'}->{'part_before_section'} = 
'<div class="part-leve
 <li><a href="#section" accesskey="1">section</a></li>
 </ul>
 <div class="chapter-level-extent" id="section">
-<h2 class="chapter">1 section</h2>
+<h2 class="chapter section-level-set-chapter">1 section</h2>
 </div>
 </div>
 ';
diff --git a/tp/t/results/sectioning/section_before_after_top_node.pl 
b/tp/t/results/sectioning/section_before_after_top_node.pl
index e400962f9e..135de1b159 100644
--- a/tp/t/results/sectioning/section_before_after_top_node.pl
+++ b/tp/t/results/sectioning/section_before_after_top_node.pl
@@ -416,7 +416,7 @@ 
$result_converted{'html'}->{'section_before_after_top_node'} = '<!DOCTYPE html>
 
 </div>
 <div class="unnumbered-level-extent" id="Top">
-<h2 class="unnumbered" id="top-section">top section</h2>
+<h2 class="unnumbered top-level-set-unnumbered" id="top-section">top 
section</h2>
 
 </div>
 <div class="chapter-level-extent" id="Chapter">
diff --git a/tp/t/results/sectioning/section_before_after_top_node_last_node.pl 
b/tp/t/results/sectioning/section_before_after_top_node_last_node.pl
index 0e06c57534..bad7506284 100644
--- a/tp/t/results/sectioning/section_before_after_top_node_last_node.pl
+++ b/tp/t/results/sectioning/section_before_after_top_node_last_node.pl
@@ -495,7 +495,7 @@ Next: <a href="#node-after" accesskey="n" rel="next">node 
after</a> &nbsp; </p>
 
 </div>
 <div class="unnumbered-level-extent" id="Top">
-<h2 class="unnumbered" id="top-section">top section</h2>
+<h2 class="unnumbered top-level-set-unnumbered" id="top-section">top 
section</h2>
 
 </div>
 <div class="chapter-level-extent" id="Chapter">
diff --git a/tp/t/results/sectioning/section_before_top.pl 
b/tp/t/results/sectioning/section_before_top.pl
index f5fde5ca3b..197e53d25d 100644
--- a/tp/t/results/sectioning/section_before_top.pl
+++ b/tp/t/results/sectioning/section_before_top.pl
@@ -566,7 +566,7 @@ Previous: <a href="#Top" accesskey="p" rel="prev">top</a>, 
Up: <a href="#Top" ac
 <p>
 Next: <a href="#section-node" accesskey="n" rel="next">section</a> &nbsp; </p>
 </div>
-<h3 class="unnumberedsec" id="top">top</h3>
+<h3 class="unnumberedsec top-level-set-unnumberedsec" id="top">top</h3>
 
 </div>
 
diff --git a/tp/t/results/sectioning/section_chapter_before_top_nodes.pl 
b/tp/t/results/sectioning/section_chapter_before_top_nodes.pl
index 843cfd2990..568ae745ff 100644
--- a/tp/t/results/sectioning/section_chapter_before_top_nodes.pl
+++ b/tp/t/results/sectioning/section_chapter_before_top_nodes.pl
@@ -926,7 +926,7 @@ Next: <a href="#chapter-node" accesskey="n" 
rel="next">chapter</a>, Up: <a href=
 <p>
 Next: <a href="#Top" accesskey="n" rel="next">top</a>, Previous: <a 
href="#section-node" accesskey="p" rel="prev">section</a>, Up: <a href="#Top" 
accesskey="u" rel="up">top</a> &nbsp; </p>
 </div>
-<h3 class="section" id="chapter">2 chapter</h3>
+<h3 class="section chapter-level-set-section" id="chapter">2 chapter</h3>
 
 
 <hr>
@@ -936,7 +936,7 @@ Next: <a href="#Top" accesskey="n" rel="next">top</a>, 
Previous: <a href="#secti
 <p>
 Next: <a href="#chapter-node" accesskey="n" rel="next">chapter</a> &nbsp; </p>
 </div>
-<h3 class="unnumberedsec" id="top">top</h3>
+<h3 class="unnumberedsec top-level-set-unnumberedsec" id="top">top</h3>
 
 
 </div>
diff --git a/tp/t/results/sectioning/unnumbered_before_node_top_top.pl 
b/tp/t/results/sectioning/unnumbered_before_node_top_top.pl
index c4929edd48..bde269bfbb 100644
--- a/tp/t/results/sectioning/unnumbered_before_node_top_top.pl
+++ b/tp/t/results/sectioning/unnumbered_before_node_top_top.pl
@@ -564,7 +564,7 @@ 
$result_converted{'html'}->{'unnumbered_before_node_top_top'} = '<!DOCTYPE html>
 </p>
 </div>
 <div class="unnumbered-level-extent" id="Top">
-<h2 class="unnumbered" id="top-section">top section</h2>
+<h2 class="unnumbered top-level-set-unnumbered" id="top-section">top 
section</h2>
 <p>Top node
 </p></div>
 
diff --git a/tp/t/results/sectioning/unnumbered_top_without_node_nodes.pl 
b/tp/t/results/sectioning/unnumbered_top_without_node_nodes.pl
index 88174a1f96..749bac034b 100644
--- a/tp/t/results/sectioning/unnumbered_top_without_node_nodes.pl
+++ b/tp/t/results/sectioning/unnumbered_top_without_node_nodes.pl
@@ -915,7 +915,7 @@ Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> 
&nbsp; </p>
 </p>
 </div>
 <div class="unnumbered-level-extent" id="top-section">
-<h2 class="unnumbered">top section</h2>
+<h2 class="unnumbered top-level-set-unnumbered">top section</h2>
 <p>Top section
 </p>
 <hr>
diff --git a/tp/t/results/sectioning/unnumbered_top_without_node_sections.pl 
b/tp/t/results/sectioning/unnumbered_top_without_node_sections.pl
index 0c68678621..9e2f5b0598 100644
--- a/tp/t/results/sectioning/unnumbered_top_without_node_sections.pl
+++ b/tp/t/results/sectioning/unnumbered_top_without_node_sections.pl
@@ -1057,7 +1057,7 @@ Up: <a href="dir.html#Top" accesskey="u" 
rel="up">(dir)</a> &nbsp; </p>
 </p>
 </div>
 <div class="unnumbered-level-extent" id="top-section">
-<h2 class="unnumbered">top section</h2>
+<h2 class="unnumbered top-level-set-unnumbered">top section</h2>
 <p>Top section
 </p>
 <hr>



reply via email to

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