[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Complete HTML menus with nodedescription
From: |
Patrice Dumas |
Subject: |
branch master updated: Complete HTML menus with nodedescription |
Date: |
Tue, 25 Jul 2023 14:46:37 -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 76836350a7 Complete HTML menus with nodedescription
76836350a7 is described below
commit 76836350a77d90e32595bec64de1f6259ea0b672
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jul 25 20:46:22 2023 +0200
Complete HTML menus with nodedescription
* tp/Texinfo/Convert/HTML.pm (_convert_menu_entry_type): replace
empty description by node_description extra information.
* tp/Texinfo/Convert/Plaintext.pm (_convert): more robust
determination of empty menu description.
* tp/t/results/menu/nodedescription_descriptions.pl
(nodedescription_descriptions): fix type in @verb name.
---
ChangeLog | 13 ++++
tp/TODO | 4 +-
tp/Texinfo/Convert/HTML.pm | 19 ++++++
tp/Texinfo/Convert/Plaintext.pm | 17 +++--
tp/t/10menu.t | 2 +-
tp/t/results/menu/nodedescription_descriptions.pl | 80 ++++++++++-------------
6 files changed, 80 insertions(+), 55 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 26adfe982d..892533a37e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-07-25 Patrice Dumas <pertusus@free.fr>
+
+ Complete HTML menus with nodedescription
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_menu_entry_type): replace
+ empty description by node_description extra information.
+
+ * tp/Texinfo/Convert/Plaintext.pm (_convert): more robust
+ determination of empty menu description.
+
+ * tp/t/results/menu/nodedescription_descriptions.pl
+ (nodedescription_descriptions): fix type in @verb name.
+
2023-07-25 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/ParserNonXS.pm (_expand_linemacro_arguments),
diff --git a/tp/TODO b/tp/TODO
index 914d29a001..f4f1f12160 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,9 +10,7 @@ This is the todo list for texi2any
Before next release
===================
-comment on linemacro call at top level comments until end of line.
-
-add @nodedescriptionblock command (if no more input from the mailing list)..
+add @nodedescriptionblock command (if no more input from the mailing list).
Bugs
====
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index d4ea0e30f7..5126713148 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6533,6 +6533,25 @@ sub _convert_menu_entry_type($$$)
#
http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions
$rel = ' rel="index"';
}
+ if ($node->{'extra'} and $node->{'extra'}->{'node_description'}) {
+ # not menu_description probably cannot happen
+ if (not $menu_description
+ # empty description
+ or (not $menu_description->{'contents'}
+ or (scalar(@{$menu_description->{'contents'}}) == 1
+ # preformatted inside menu_entry_description
+ and (not
($menu_description->{'contents'}->[0]->{'contents'})
+ or (scalar(@{$menu_description->{'contents'}->[0]
+ ->{'contents'}}) == 1)
+ and defined($menu_description->{'contents'}->[0]
+ ->{'contents'}->[0]->{'text'})
+ and $menu_description->{'contents'}->[0]
+ ->{'contents'}->[0]->{'text'} !~ /\S/)))) {
+
+ $menu_description
+ = $node->{'extra'}->{'node_description'}->{'args'}->[0];
+ }
+ }
}
}
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 0dcc5952ec..760fda8382 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -3448,13 +3448,16 @@ sub _convert($$)
# empty description
} elsif ($content->{'type'} eq 'menu_entry_description'
- and $content->{'contents'}
- and scalar(@{$content->{'contents'}}) == 1
- # preformatted inside menu_entry_description
- and $content->{'contents'}->[0]->{'contents'}
- and scalar(@{$content->{'contents'}->[0]->{'contents'}}) == 1
- and
defined($content->{'contents'}->[0]->{'contents'}->[0]->{'text'})
- and $content->{'contents'}->[0]->{'contents'}->[0]->{'text'}
!~ /\S/) {
+ and (not $content->{'contents'}
+ or (scalar(@{$content->{'contents'}}) == 1
+ # preformatted inside menu_entry_description
+ and (not ($content->{'contents'}->[0]->{'contents'})
+ or (scalar(@{$content->{'contents'}->[0]
+ ->{'contents'}}) == 1)
+ and defined($content->{'contents'}->[0]
+ ->{'contents'}->[0]->{'text'})
+ and $content->{'contents'}->[0]
+ ->{'contents'}->[0]->{'text'} !~ /\S/)))) {
if ($menu_entry_node and $menu_entry_node->{'extra'}
and defined($menu_entry_node->{'extra'}->{'normalized'})
and $self->{'labels'}
diff --git a/tp/t/10menu.t b/tp/t/10menu.t
index f8707b5a86..d2d44a1d24 100644
--- a/tp/t/10menu.t
+++ b/tp/t/10menu.t
@@ -531,7 +531,7 @@ Text
@node toto
@chapter Toto
-@nodedescription toto is there:: and the @emph{is a description}@w{slightly
long} and @ver{:vv somewhat:} @ringaccent anexpected
+@nodedescription toto is there:: and the @emph{is a description}@w{slightly
long} and @verb{:vv somewhat:} @ringaccent anexpected
@node titi
@chapter Titi
diff --git a/tp/t/results/menu/nodedescription_descriptions.pl
b/tp/t/results/menu/nodedescription_descriptions.pl
index df27e6c8ba..dd04a8bc31 100644
--- a/tp/t/results/menu/nodedescription_descriptions.pl
+++ b/tp/t/results/menu/nodedescription_descriptions.pl
@@ -561,7 +561,32 @@ $result_trees{'nodedescription_descriptions'} = {
}
},
{
- 'text' => ' and :vv somewhat: '
+ 'text' => ' and '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'vv somewhat',
+ 'type' => 'raw'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'verb',
+ 'info' => {
+ 'delimiter' => ':'
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 18,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
},
{
'args' => [
@@ -1349,7 +1374,7 @@ $result_texis{'nodedescription_descriptions'} = '@node Top
@node toto
@chapter Toto
-@nodedescription toto is there:: and the @emph{is a description}@w{slightly
long} and :vv somewhat: @ringaccent anexpected
+@nodedescription toto is there:: and the @emph{is a description}@w{slightly
long} and @verb{:vv somewhat:} @ringaccent anexpected
@node titi
@chapter Titi
@@ -1883,35 +1908,7 @@
$result_menus{'nodedescription_descriptions'}{'structure'}{'menu_child'}{'struct
$result_menus{'nodedescription_descriptions'}{'structure'}{'menu_child'}{'structure'}{'menu_next'}{'structure'}{'menu_up'}
= $result_menus{'nodedescription_descriptions'};
$result_menus{'nodedescription_descriptions'}{'structure'}{'menu_child'}{'structure'}{'menu_up'}
= $result_menus{'nodedescription_descriptions'};
-$result_errors{'nodedescription_descriptions'} = [
- {
- 'error_line' => 'unknown command `ver\'
-',
- 'file_name' => '',
- 'line_nr' => 18,
- 'macro' => '',
- 'text' => 'unknown command `ver\'',
- 'type' => 'error'
- },
- {
- 'error_line' => 'misplaced {
-',
- 'file_name' => '',
- 'line_nr' => 18,
- 'macro' => '',
- 'text' => 'misplaced {',
- 'type' => 'error'
- },
- {
- 'error_line' => 'misplaced }
-',
- 'file_name' => '',
- 'line_nr' => 18,
- 'macro' => '',
- 'text' => 'misplaced }',
- 'type' => 'error'
- }
-];
+$result_errors{'nodedescription_descriptions'} = [];
$result_floats{'nodedescription_descriptions'} = {};
@@ -1924,8 +1921,8 @@
$result_converted{'plaintext'}->{'nodedescription_descriptions'} = 'test of node
* Menu:
* toto:: toto is there:: and the _is a
- description_slightly long and :vv
- somewhat: ånexpected
+ description_slightly long and vv somewhat
+ ånexpected
* titi:: desc of titi
* name of other: other. other comes here
@@ -1999,22 +1996,17 @@ Next: <a href="#toto" accesskey="n" rel="next">Toto</a>
</p>
<h1 class="top" id="test-of-nodedescription-used-in-menu"><span>test of
nodedescription used in menu<a class="copiable-link"
href="#test-of-nodedescription-used-in-menu"> ¶</a></span></h1>
<table class="menu" border="0" cellspacing="0">
-<tr><td class="menu-entry-destination">• <a href="#toto"
accesskey="1">toto</a>:</td><td> </td><td
class="menu-entry-description">
-</td></tr>
+<tr><td class="menu-entry-destination">• <a href="#toto"
accesskey="1">toto</a>:</td><td> </td><td
class="menu-entry-description">toto is there:: and the <em class="emph">is a
description</em>slightly long<!-- /@w --> and <code
class="verb">vv somewhat</code> ånexpected</td></tr>
<tr><td class="menu-entry-destination">• <a href="#titi"
accesskey="2">titi</a>:</td><td> </td><td
class="menu-entry-description">desc of titi
</td></tr>
-<tr><td class="menu-entry-destination">• <a href="#other"
accesskey="3">name of other</a>:</td><td> </td><td
class="menu-entry-description">
-</td></tr>
+<tr><td class="menu-entry-destination">• <a href="#other"
accesskey="3">name of other</a>:</td><td> </td><td
class="menu-entry-description">other comes here</td></tr>
<tr><th class="menu-comment" colspan="3"><pre
class="menu-comment-preformatted">
</pre></th></tr><tr><td class="menu-entry-destination">• <a href="#last"
accesskey="4">name of last</a>:</td><td> </td><td
class="menu-entry-description">desc of last
</td></tr>
-<tr><td class="menu-entry-destination">• <a
href="#a-somewhat-long-node-without-description-nor-following-space"
accesskey="5">a somewhat long node without description nor following
space</a>:</td><td> </td><td class="menu-entry-description">
-</td></tr>
-<tr><td class="menu-entry-destination">• <a
href="#a-very-long-node-without-description-with-little-space-left-for"
accesskey="6">a very long node without description with little space left
for</a>:</td><td> </td><td class="menu-entry-description">
-</td></tr>
-<tr><td class="menu-entry-destination">• <a
href="#very-very-long-node-extending-past-the-max-columns-and-without-description"
accesskey="7">very very long node extending past the max columns and without
description</a>:</td><td> </td><td class="menu-entry-description">
-</td></tr>
+<tr><td class="menu-entry-destination">• <a
href="#a-somewhat-long-node-without-description-nor-following-space"
accesskey="5">a somewhat long node without description nor following
space</a>:</td><td> </td><td class="menu-entry-description">not as
long as the node</td></tr>
+<tr><td class="menu-entry-destination">• <a
href="#a-very-long-node-without-description-with-little-space-left-for"
accesskey="6">a very long node without description with little space left
for</a>:</td><td> </td><td class="menu-entry-description">starting
the desciption with a somewhat long word</td></tr>
+<tr><td class="menu-entry-destination">• <a
href="#very-very-long-node-extending-past-the-max-columns-and-without-description"
accesskey="7">very very long node extending past the max columns and without
description</a>:</td><td> </td><td
class="menu-entry-description">Not long</td></tr>
</table>
<hr>
@@ -2113,7 +2105,7 @@
$result_converted{'xml'}->{'nodedescription_descriptions'} = '<node name="Top" s
<node name="toto" spaces=" "><nodename>toto</nodename><nodenext
automatic="on">titi</nodenext><nodeprev automatic="on">Top</nodeprev><nodeup
automatic="on">Top</nodeup></node>
<chapter spaces=" "><sectiontitle>Toto</sectiontitle>
-<nodedescription spaces=" ">toto is there:: and the <emph>is a
description</emph><w>slightly long</w> and :vv somewhat: <accent type="ring"
spacesaftercmd=" " bracketed="off">a</accent>nexpected</nodedescription>
+<nodedescription spaces=" ">toto is there:: and the <emph>is a
description</emph><w>slightly long</w> and <verb delimiter=":">vv
somewhat</verb> <accent type="ring" spacesaftercmd=" "
bracketed="off">a</accent>nexpected</nodedescription>
</chapter>
<node name="titi" spaces=" "><nodename>titi</nodename><nodenext
automatic="on">other</nodenext><nodeprev automatic="on">toto</nodeprev><nodeup
automatic="on">Top</nodeup></node>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Complete HTML menus with nodedescription,
Patrice Dumas <=