texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Automatic menu in HTML if missing and FORMAT_MENU


From: Patrice Dumas
Subject: branch master updated: Automatic menu in HTML if missing and FORMAT_MENU is menu
Date: Sat, 09 Sep 2023 06:05:12 -0400

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 a6f55a6102 Automatic menu in HTML if missing and FORMAT_MENU is menu
a6f55a6102 is described below

commit a6f55a610293eadc68a193c39bf0264cfc0bcb6e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Sep 9 12:04:59 2023 +0200

    Automatic menu in HTML if missing and FORMAT_MENU is menu
    
    * tp/Texinfo/Convert/HTML.pm (%available_converter_info)
    (_convert_heading_command): add 'labels' to the
    %available_converter_info.  Automatic menu setup and formatting if
    FORMAT_MENU is menu, a sectioning command is being formatted,
    associated node is with automatic directions and without menu
    and there is no table of contents already formatted.
---
 ChangeLog                                          | 11 ++++++++
 doc/texi2any_api.texi                              |  6 ++++
 tp/Texinfo/Convert/HTML.pm                         | 33 ++++++++++++++++++----
 .../res_parser/formatting_html32/formatting.html   |  4 +++
 .../documentlanguage_cmdline/documentlanguage.html |  6 ++++
 .../formatting_enable_encoding/formatting.html     |  4 +++
 .../res_parser/formatting_fr/formatting.html       |  4 +++
 .../res_parser/formatting_fr_icons/formatting.html |  4 +++
 .../formatting_inline_css/formatting.html          |  4 +++
 .../formatting_numerical_entities/formatting.html  |  4 +++
 .../formatting_texi2html/formatting.html           |  4 +++
 .../formatting_texi2html_nodes/chapter.html        |  6 ++++
 .../formatting_weird_quotes/formatting.html        |  4 +++
 .../encod\303\251/tex_encod\303\251_utf8.html"     |  6 ++++
 .../encod\303\251/tex_encod\303\251_utf8.html"     |  6 ++++
 .../res_parser/formatting_singular/chapter.html    |  6 ++++
 16 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 62bd5ce71f..657a220e91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-09-09  Patrice Dumas <pertusus@free.fr>
+
+       Automatic menu in HTML if missing and FORMAT_MENU is menu
+
+       * tp/Texinfo/Convert/HTML.pm (%available_converter_info)
+       (_convert_heading_command): add 'labels' to the
+       %available_converter_info.  Automatic menu setup and formatting if
+       FORMAT_MENU is menu, a sectioning command is being formatted,
+       associated node is with automatic directions and without menu
+       and there is no table of contents already formatted.
+
 2023-09-09  Patrice Dumas <pertusus@free.fr>
 
        * tp/Texinfo/Structuring.pm (new_complete_menu_master_menu),
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 07dc423863..ec2d099e41 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -1775,6 +1775,12 @@ information on each of the file licences, with content
 @item file name or source of file
 @end enumerate
 
+@item labels
+Association of identifiers to label elements. Gathered from the Texinfo
+parsing result.
+@xref{Texinfo::Parser $labels_information@comma{} $targets_list@comma{} 
$nodes_list = labels_information($parser),,
+Texinfo::Parser::labels_information,texi2any_internals}.
+
 @item line_break_element
 HTML line break element, based on @samp{<br>}, also taking into account
 @code{USE_XML_SYNTAX} customization variable value.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 7338bc245b..cc355051d4 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1802,7 +1802,8 @@ foreach my $converter_info ('copying_comment', 
'current_filename',
    'destination_directory', 'document_name', 'documentdescription_string',
    'floats', 'global_commands',
    'index_entries', 'index_entries_by_letter', 'indices_information',
-   'jslicenses', 'line_break_element', 'non_breaking_space', 
'paragraph_symbol',
+   'jslicenses', 'labels',
+   'line_break_element', 'non_breaking_space', 'paragraph_symbol',
    'simpletitle_command_name', 'simpletitle_tree', 'structuring',
    'title_string', 'title_tree', 'title_titlepage') {
   $available_converter_info{$converter_info} = 1;
@@ -4149,11 +4150,31 @@ sub _convert_heading_command($$$$$)
     }
   }
 
-  my $mini_toc = '';
+  my $mini_toc_or_auto_menu = '';
   if ($tables_of_contents eq ''
-      and $self->get_conf('FORMAT_MENU') eq 'sectiontoc'
       and $sectioning_heading_commands{$cmdname}) {
-    $mini_toc = _mini_toc($self, $element);
+    if ($self->get_conf('FORMAT_MENU') eq 'sectiontoc') {
+      $mini_toc_or_auto_menu = _mini_toc($self, $element);
+    } elsif ($self->get_conf('FORMAT_MENU') eq 'menu') {
+      my $node = $element->{'extra'}->{'associated_node'}
+        if ($element->{'extra'} and $element->{'extra'}->{'associated_node'});
+
+      my $automatic_directions = 1;
+      if ($node and $node->{'args'} and scalar(@{$node->{'args'}}) > 1) {
+        $automatic_directions = 0;
+      }
+
+      if ($node->{'extra'}
+          and not $node->{'extra'}->{'menus'}
+          and $automatic_directions) {
+        my $menu_node
+          = Texinfo::Structuring::new_complete_menu_master_menu($self,
+                                            $self->get_info('labels'), $node);
+        if ($menu_node) {
+          $mini_toc_or_auto_menu = $self->convert_tree($menu_node);
+        }
+      }
+    }
   }
 
   if ($self->get_conf('NO_TOP_NODE_OUTPUT')
@@ -4182,7 +4203,7 @@ sub _convert_heading_command($$$$$)
                                                         $element_id, 
$id_class);
       $result .= $element_header;
       $result .= $tables_of_contents;
-      $result .= $mini_toc;
+      $result .= $mini_toc_or_auto_menu;
       return $result;
     }
   }
@@ -4349,7 +4370,7 @@ sub _convert_heading_command($$$$$)
   $result .= $content if (defined($content));
 
   $result .= $tables_of_contents;
-  $result .= $mini_toc;
+  $result .= $mini_toc_or_auto_menu;
   return $result;
 }
 
diff --git a/tp/tests/coverage/res_parser/formatting_html32/formatting.html 
b/tp/tests/coverage/res_parser/formatting_html32/formatting.html
index 6823728336..8453d6e792 100644
--- a/tp/tests/coverage/res_parser/formatting_html32/formatting.html
+++ b/tp/tests/coverage/res_parser/formatting_html32/formatting.html
@@ -7077,6 +7077,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table border="0" cellspacing="0">
+<tr><td>* <a 
href="#s_002d_002dect_002cion">s--ect,ion</a>:</td><td>&nbsp;&nbsp;</td><td>
+</td></tr>
+</table>
 <hr>
 <div id="s_002d_002dect_002cion">
 <div>
diff --git 
a/tp/tests/formatting/res_parser/documentlanguage_cmdline/documentlanguage.html 
b/tp/tests/formatting/res_parser/documentlanguage_cmdline/documentlanguage.html
index 5d174c6bab..b47d0e2485 100644
--- 
a/tp/tests/formatting/res_parser/documentlanguage_cmdline/documentlanguage.html
+++ 
b/tp/tests/formatting/res_parser/documentlanguage_cmdline/documentlanguage.html
@@ -20,6 +20,8 @@ span.program-in-footer {font-size: smaller}
 span:hover a.copiable-link {visibility: visible}
 strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
 td.button-direction-about {text-align:center}
+td.menu-entry-description {vertical-align: top}
+td.menu-entry-destination {vertical-align: top}
 td.name-direction-about {text-align:center}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top; padding-left: 1em}
@@ -45,6 +47,10 @@ th.sections-header-printindex {text-align:left; 
padding-left: 1em}
 </tr></table>
 <h1 class="top" id="top-section"><span>top section<a class="copiable-link" 
href="#top-section"> &para;</a></span></h1>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a href="#chapter" rel="index">1 
Chapter</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr style="height: 6px;">
 <div class="chapter-level-extent" id="chapter">
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git 
a/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html 
b/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
index 93db1c528d..c0a613ab18 100644
--- a/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
@@ -7254,6 +7254,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination">• <a href="#s_002d_002dect_002cion" 
accesskey="1">s--ect,ion</a>:</td><td>  </td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <div class="nav-panel">
diff --git a/tp/tests/layout/res_parser/formatting_fr/formatting.html 
b/tp/tests/layout/res_parser/formatting_fr/formatting.html
index 39a7d75843..f35613a45f 100644
--- a/tp/tests/layout/res_parser/formatting_fr/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_fr/formatting.html
@@ -7233,6 +7233,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a href="#s_002d_002dect_002cion">1.1 A 
section</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git a/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html 
b/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
index 5bd87665f4..4183854797 100644
--- a/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
@@ -7233,6 +7233,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a href="#s_002d_002dect_002cion">1.1 A 
section</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git a/tp/tests/layout/res_parser/formatting_inline_css/formatting.html 
b/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
index 8aa3de0ab6..4d8d88e789 100644
--- a/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
@@ -7183,6 +7183,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination" style="vertical-align: top">&bull; <a 
href="#s_002d_002dect_002cion" 
accesskey="1">s--ect,ion</a>:</td><td>&nbsp;&nbsp;</td><td 
class="menu-entry-description" style="vertical-align: top">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <div class="nav-panel">
diff --git 
a/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html 
b/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
index 940b847bcc..ae98c3fb42 100644
--- a/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
@@ -7254,6 +7254,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination">&#8226; <a 
href="#s_002d_002dect_002cion" 
accesskey="1">s--ect&#44;ion</a>:</td><td>&#160;&#160;</td><td 
class="menu-entry-description">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <div class="nav-panel">
diff --git a/tp/tests/layout/res_parser/formatting_texi2html/formatting.html 
b/tp/tests/layout/res_parser/formatting_texi2html/formatting.html
index ab244b7d17..1bf3d7d92d 100644
--- a/tp/tests/layout/res_parser/formatting_texi2html/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_texi2html/formatting.html
@@ -7233,6 +7233,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a href="#s_002d_002dect_002cion">1.1 A 
section</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git a/tp/tests/layout/res_parser/formatting_texi2html_nodes/chapter.html 
b/tp/tests/layout/res_parser/formatting_texi2html_nodes/chapter.html
index 196346af14..c89e5106a7 100644
--- a/tp/tests/layout/res_parser/formatting_texi2html_nodes/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_texi2html_nodes/chapter.html
@@ -880,6 +880,8 @@ span:hover a.copiable-link {visibility: visible}
 strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
 td.index-entry-level-1 {padding-left: 1.5em}
 td.index-entry-level-2 {padding-left: 3.0em}
+td.menu-entry-description {vertical-align: top}
+td.menu-entry-destination {vertical-align: top}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top; padding-left: 1em}
 td.printindex-index-see-also {vertical-align: top; padding-left: 1em}
@@ -5006,6 +5008,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a 
href="s_002d_002dect_002cion.html">1.1 A 
section</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 </div>
 <hr>
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git a/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html 
b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
index d2890cf97b..2fbaaf2ed5 100644
--- a/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
@@ -7254,6 +7254,10 @@ Menu comment
 </pre></td></tr></table>
 </div>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination">&bull; <a 
href="#s_002d_002dect_002cion" 
accesskey="1">s--ect,ion</a>:</td><td>&nbsp;&nbsp;</td><td 
class="menu-entry-description">
+</td></tr>
+</table>
 <hr>
 <div class="section-level-extent" id="s_002d_002dect_002cion">
 <div class="nav-panel">
diff --git 
"a/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
 
"b/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
index c81f5b1872..2d39c13383 100644
--- 
"a/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
+++ 
"b/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
@@ -18,6 +18,8 @@ a.copiable-link {visibility: hidden; text-decoration: none; 
line-height: 0em}
 span.program-in-footer {font-size: smaller}
 span:hover a.copiable-link {visibility: visible}
 td.button-direction-about {text-align:center}
+td.menu-entry-description {vertical-align: top}
+td.menu-entry-destination {vertical-align: top}
 td.name-direction-about {text-align:center}
 -->
 </style>
@@ -37,6 +39,10 @@ td.name-direction-about {text-align:center}
 </tr></table>
 <h1 class="top" id="top"><span>top<a class="copiable-link" href="#top"> 
&para;</a></span></h1>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a href="#Chapter">1 
chap</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr style="height: 6px;">
 <div class="chapter-level-extent" id="Chapter">
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git 
"a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
 
"b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
index 8f899b1c46..1d00cda086 100644
--- 
"a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
+++ 
"b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
@@ -20,6 +20,8 @@ a.copiable-link {visibility: hidden; text-decoration: none; 
line-height: 0em}
 span.program-in-footer {font-size: smaller}
 span:hover a.copiable-link {visibility: visible}
 td.button-direction-about {text-align:center}
+td.menu-entry-description {vertical-align: top}
+td.menu-entry-destination {vertical-align: top}
 td.name-direction-about {text-align:center}
 -->
 </style>
@@ -39,6 +41,10 @@ td.name-direction-about {text-align:center}
 </tr></table>
 <h1 class="top" id="top"><span>top<a class="copiable-link" href="#top"> 
&para;</a></span></h1>
 
+<table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a href="#Chapter">1 
chap</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table>
 <hr style="height: 6px;">
 <div class="chapter-level-extent" id="Chapter">
 <table class="nav-panel" cellpadding="1" cellspacing="1" border="0">
diff --git a/tp/tests/tex_html/res_parser/formatting_singular/chapter.html 
b/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
index 114028a5b3..85b540c3fe 100644
--- a/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
+++ b/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
@@ -880,6 +880,8 @@ span:hover a.copiable-link {visibility: visible}
 strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
 td.index-entry-level-1 {padding-left: 1.5em}
 td.index-entry-level-2 {padding-left: 3.0em}
+td.menu-entry-description {vertical-align: top}
+td.menu-entry-destination {vertical-align: top}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top; padding-left: 1em}
 td.printindex-index-see-also {vertical-align: top; padding-left: 1em}
@@ -5439,6 +5441,10 @@ Menu comment
 </pre></table></blockquote>
 </div>
 
+<blockquote><table class="menu" border="0" cellspacing="0">
+<tr><td class="menu-entry-destination"><a 
href="s_002d_002dect_002cion.html">1.1 A 
section</a></td><td>&nbsp;&nbsp;</td><td class="menu-entry-description">
+</td></tr>
+</table></blockquote>
 </td>
 </tr>
 </table>



reply via email to

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