bug-texinfo
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sat, 13 Feb 2021 17:50:18 -0500 (EST)

branch: master
commit 3967b8311b53539b61967022a2fd60fd06804ebd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 13 23:22:09 2021 +0100

    * tp/init/book.pm (book_convert_heading_command): update with
    changes in HTML main converter.
---
 ChangeLog                                          |  5 +++++
 tp/Texinfo/Convert/HTML.pm                         |  2 +-
 tp/init/book.pm                                    | 23 ++++++++++++++++++++--
 .../double_contents_book/double_contents.html      | 21 +++++++++++---------
 4 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fde35c5..c3d0d38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-13  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/init/book.pm (book_convert_heading_command): update with
+       changes in HTML main converter.
+
 2021-02-13  Per Bothner <per@bothner.com>
 
        Use the sectionning tree structure in HTML output
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 2a50f47..0bd8a26 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2464,6 +2464,7 @@ sub _convert_heading_command($$$$$)
   my $element_id = $self->command_id($command);
   $result .= " id=\"$element_id\""
       if (defined($element_id) and $element_id ne '');
+  $result .= ">\n";
 
   print STDERR "Process $command "
         .Texinfo::Structuring::_print_root_command_texi($command)."\n"
@@ -2475,7 +2476,6 @@ sub _convert_heading_command($$$$$)
       and $command->{'parent'}->{'type'} eq 'element') {
     $element = $command->{'parent'};
   }
-  $result .= ">\n";
   if ($element) {
     $result .= &{$self->{'format_element_header'}}($self, $cmdname, 
                                             $command, $element);
diff --git a/tp/init/book.pm b/tp/init/book.pm
index dc90a87..f8a86b7 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -164,9 +164,27 @@ sub book_convert_heading_command($$$$$)
     $result .= $content if (defined($content));
     return $result;
   }
+  my $section = $command->{'extra'}->{'associated_section'};
+  my $node;
+  if ($section) {
+      my $level = $section->{'level'};
+      $result .= join('', $self->close_registered_sections_level($level));
+      $self->register_opened_section_level($level, "</div>\n");
+  } else {
+      $node = $command->{'extra'}->{'associated_node'};
+  }
+  $result .= '<div';
+  if ($section) {
+      $result .= ' class="'.$section->{'cmdname'}.'"';
+  } elsif ($node) {
+      $result .= ' class="node"';
+  } else {
+      $result .= " class=\"$cmdname\"";
+  }
   my $element_id = $self->command_id($command);
-  $result .= "<a name=\"$element_id\"></a>\n"
-    if (defined($element_id) and $element_id ne '');
+  $result .= " id=\"$element_id\""
+      if (defined($element_id) and $element_id ne '');
+  $result .= ">\n";
 
   print STDERR "Process $command "
         .Texinfo::Structuring::_print_root_command_texi($command)."\n"
@@ -238,6 +256,7 @@ sub book_convert_heading_command($$$$$)
     $result .= "</ul>\n";
   }
   $result .= $content if (defined($content));
+  $result .= '</div>' if (! $section);
   return $result;
 }
 
diff --git 
a/tp/tests/contents/res_parser/double_contents_book/double_contents.html 
b/tp/tests/contents/res_parser/double_contents_book/double_contents.html
index 6149c30..e361bfa 100644
--- a/tp/tests/contents/res_parser/double_contents_book/double_contents.html
+++ b/tp/tests/contents/res_parser/double_contents_book/double_contents.html
@@ -49,7 +49,7 @@ ul.no-bullet {list-style: none}
 </div>
 
 
-<a name="Top"></a>
+<div class="top" id="Top">
 <table class="header" cellpadding="1" cellspacing="1" border="0">
 <tr><td valign="middle" align="left">[ &lt; ]</td>
 <td valign="middle" align="left">[<a href="#chapter" title="Next section in 
reading order"> &gt; </a>]</td>
@@ -58,14 +58,14 @@ ul.no-bullet {list-style: none}
 <td valign="middle" align="left">[Index]</td>
 <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? 
</a>]</td>
 </tr></table>
-<a name="Double-contents"></a>
+<div class="node" id="Double-contents">
 <h1 class="top">Double contents</h1>
 
 <p>Double contents.
 </p>
 
-<hr>
-<a name="chapter"></a>
+</div><hr>
+<div class="chapter" id="chapter">
 <table class="header" cellpadding="1" cellspacing="1" border="0">
 <tr><td valign="middle" align="left">[<a href="#Top" title="Previous section 
in reading order"> &lt; </a>]</td>
 <td valign="middle" align="left">[<a href="#section" title="Next section in 
reading order"> &gt; </a>]</td>
@@ -74,7 +74,7 @@ ul.no-bullet {list-style: none}
 <td valign="middle" align="left">[Index]</td>
 <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? 
</a>]</td>
 </tr></table>
-<a name="Chapter-1"></a>
+<div class="node" id="Chapter-1">
 <h1 class="chapter">1 Chapter 1</h1>
 <ul class="no-bullet">
 <li> <a href="#section">1.1 section with contents</a> </li>
@@ -96,8 +96,8 @@ ul.no-bullet {list-style: none}
 <p>The chapter
 </p>
 
-<hr>
-<a name="section"></a>
+</div><hr>
+<div class="section" id="section">
 <table class="header" cellpadding="1" cellspacing="1" border="0">
 <tr><td valign="middle" align="left">[<a href="#chapter" title="Previous 
section in reading order"> &lt; </a>]</td>
 <td valign="middle" align="left">[ &gt; ]</td>
@@ -106,7 +106,7 @@ ul.no-bullet {list-style: none}
 <td valign="middle" align="left">[Index]</td>
 <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? 
</a>]</td>
 </tr></table>
-<a name="section-with-contents"></a>
+<div class="node" id="section-with-contents">
 <h2 class="section">1.1 section with contents</h2>
 <span id="SEC_Contents"></span>
 <h1 class="contents-heading">Table of Contents</h1>
@@ -122,7 +122,10 @@ ul.no-bullet {list-style: none}
 </div>
 
 
-<hr>
+</div><hr>
+</div>
+</div>
+</div>
 <div class="About_element" id="SEC_About">
 <table class="header" cellpadding="1" cellspacing="1" border="0">
 <tr><td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of 
contents">Contents</a>]</td>



reply via email to

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