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_printindex


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_printindex_command): put hyperlink within span used for indentation of subentries.
Date: Wed, 09 Nov 2022 16:51:55 -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 27a0a46f8e * tp/Texinfo/Convert/HTML.pm (_convert_printindex_command): 
put hyperlink within span used for indentation of subentries.
27a0a46f8e is described below

commit 27a0a46f8e03225559c0c7782fcd3bf1369828eb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Nov 9 22:51:44 2022 +0100

    * tp/Texinfo/Convert/HTML.pm (_convert_printindex_command): put
    hyperlink within span used for indentation of subentries.
---
 ChangeLog                                          |  5 ++++
 doc/texi2any_api.texi                              |  2 +-
 tp/Texinfo/Convert/HTML.pm                         |  9 +++---
 tp/t/results/indices/seealso_duplicate.pl          |  4 +--
 tp/t/results/indices/sorted_subentries.pl          | 30 ++++++++++----------
 tp/t/results/indices/subentries.pl                 | 12 ++++----
 tp/t/results/indices/subentry_and_sortas.pl        |  4 +--
 tp/t/results/indices/subentry_and_sortas_spaces.pl |  8 +++---
 .../layout/res_parser/formatting/formatting.html   | 32 +++++++++++-----------
 .../layout/res_parser/formatting_chm/chapter.html  | 16 +++++------
 .../layout/res_parser/formatting_chm/chapter2.html | 16 +++++------
 .../formatting_enable_encoding/formatting.html     | 32 +++++++++++-----------
 .../EPUB/xhtml/chapter.xhtml                       | 16 +++++------
 .../EPUB/xhtml/chapter2.xhtml                      | 16 +++++------
 .../EPUB/xhtml/chapter.xhtml                       | 16 +++++------
 .../EPUB/xhtml/chapter2.xhtml                      | 16 +++++------
 .../res_parser/formatting_exotic/chapter.html      | 16 +++++------
 .../res_parser/formatting_exotic/chapter2.html     | 16 +++++------
 .../res_parser/formatting_fr_icons/formatting.html | 32 +++++++++++-----------
 .../res_parser/formatting_html/formatting.html     | 32 +++++++++++-----------
 .../formatting_html_no_texi2html/formatting.html   | 32 +++++++++++-----------
 .../res_parser/formatting_html_nodes/chapter.html  | 16 +++++------
 .../res_parser/formatting_html_nodes/chapter2.html | 16 +++++------
 .../formatting_inline_css/formatting.html          | 32 +++++++++++-----------
 .../res_parser/formatting_mathjax/formatting.html  | 32 +++++++++++-----------
 .../res_parser/formatting_nodes/chapter.html       | 16 +++++------
 .../res_parser/formatting_nodes/chapter2.html      | 16 +++++------
 .../formatting_numerical_entities/formatting.html  | 32 +++++++++++-----------
 .../formatting_sort_element_counts/formatting.html | 32 +++++++++++-----------
 .../formatting_weird_quotes/formatting.html        | 32 +++++++++++-----------
 .../res_parser/formatting_xhtml/formatting.html    | 32 +++++++++++-----------
 .../res_parser/formatting_singular/chapter.html    | 16 +++++------
 .../res_parser/formatting_singular/chapter2.html   | 16 +++++------
 33 files changed, 328 insertions(+), 322 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index de9148e07a..3cf0501023 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-11-09  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_convert_printindex_command): put
+       hyperlink within span used for indentation of subentries.
+
 2022-11-09  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * configure.ac (AM_INIT_AUTOMAKE): Increase required automake
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 0ae712adde..d1a027b0ec 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -425,7 +425,7 @@ are usually rendered using @code{<pre>} elements in HTML.
 @item code context
 When quotes and minus are kept.  In particular @code{---}, @code{``}
 and other similar constructs are not converted to dash and quote special
-characters.  For exampe, in @code{@@code} or @code{@@option} commands
+characters.  For example, in @code{@@code} or @code{@@option} commands
 (@pxref{Useful Highlighting,,, texinfo, Texinfo}).
 
 @item math context
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index b0a82c6f0e..4bff5d4495 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5641,15 +5641,17 @@ sub _convert_printindex_command($$$$)
 
       $normalized_entry_levels = [@new_normalized_entry_levels];
       $entry = '<code>' .$entry .'</code>' if ($index_entry_ref->{'in_code'});
+      my $entry_href = 
$self->command_href($index_entry_ref->{'entry_element'});
+      my $formatted_entry = "<a href=\"$entry_href\">$entry</a>";
       # indent if it is a subentry
       if ($entry_level > 0) {
         my $open = $self->html_attribute_class('span', 
["index-entry-level-$entry_level"]);
         if ($open ne '') {
           $open .= '>';
-          $entry = $open.$entry.'</span>';
+          $formatted_entry = $open.$formatted_entry.'</span>';
         }
       }
-      my $entry_href = 
$self->command_href($index_entry_ref->{'entry_element'});
+
       my $associated_command;
       if ($self->get_conf('NODE_NAME_IN_INDEX')) {
         $associated_command = $index_entry_ref->{'entry_node'};
@@ -5676,8 +5678,7 @@ sub _convert_printindex_command($$$$)
       
       $entries_text .= '<tr><td></td>'
         .$self->html_attribute_class('td', ["$cmdname-index-entry"]).'>'
-         . "<a href=\"$entry_href\">$entry</a>" .
-          $self->get_conf('INDEX_ENTRY_COLON') .
+         . $formatted_entry . $self->get_conf('INDEX_ENTRY_COLON') .
         '</td><td>'.$self->get_info('non_breaking_space').'</td>'
         .$self->html_attribute_class('td', ["$cmdname-index-section"]).'>';
       $entries_text .= "<a 
href=\"$associated_command_href\">$associated_command_text</a>"
diff --git a/tp/t/results/indices/seealso_duplicate.pl 
b/tp/t/results/indices/seealso_duplicate.pl
index a8ea2c4462..6c56a2639c 100644
--- a/tp/t/results/indices/seealso_duplicate.pl
+++ b/tp/t/results/indices/seealso_duplicate.pl
@@ -398,8 +398,8 @@ $result_converted{'html_text'}->{'seealso_duplicate'} = 
'<h1 class="node" id="To
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code 
class="command">awk</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-awk"><span 
class="index-entry-level-1">POSIX and</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-awk-1"><span 
class="index-entry-level-1">POSIX and</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a href="#index-awk">POSIX 
and</a></span>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a href="#index-awk-1">POSIX 
and</a></span>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 </div>
diff --git a/tp/t/results/indices/sorted_subentries.pl 
b/tp/t/results/indices/sorted_subentries.pl
index dae36f873d..ef6928e1ec 100644
--- a/tp/t/results/indices/sorted_subentries.pl
+++ b/tp/t/results/indices/sorted_subentries.pl
@@ -2197,30 +2197,30 @@ $result_converted{'html_text'}->{'sorted_subentries'} = 
'<div class="top-level-e
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">aa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aa"><span 
class="index-entry-level-1">bb</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aa-1"><span 
class="index-entry-level-1">dd</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aa">bb</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aa-1">dd</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">ab</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-ab"><span 
class="index-entry-level-1">cc</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-ab">cc</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-B">B</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">bb</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-bb"><span 
class="index-entry-level-1">cc</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-bb">cc</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-H">H</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-hhh-4">hhh</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-hhh-7">hhh</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-3"><span 
class="index-entry-level-1"></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-1"><span 
class="index-entry-level-1">jjj</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-8"><span 
class="index-entry-level-1">jjj</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-10"><span 
class="index-entry-level-2">lll</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh"><span 
class="index-entry-level-2">lll</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-6"><span 
class="index-entry-level-2">lll</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-5"><span 
class="index-entry-level-2">lll, ppp</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-9"><span 
class="index-entry-level-2"><a class="email" 
href="mailto:jjj";>mymail</a></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-2"><span 
class="index-entry-level-1">k</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-11"><span 
class="index-entry-level-2">nnn</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-hhh-3"></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-hhh-1">jjj</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-hhh-8">jjj</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-hhh-10">lll</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-hhh">lll</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-hhh-6">lll</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-hhh-5">lll, 
ppp</a></span>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter-one">chapter one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-hhh-9"><a class="email" 
href="mailto:jjj";>mymail</a></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-hhh-2">k</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-one">chapter 
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-hhh-11">nnn</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">l</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-12"><span 
class="index-entry-level-2">third</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-hhh-12">third</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-second">chapter 
second</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-jjj">hhh 
jjj</a>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter-one">chapter one</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
diff --git a/tp/t/results/indices/subentries.pl 
b/tp/t/results/indices/subentries.pl
index ccaa308676..653bff6341 100644
--- a/tp/t/results/indices/subentries.pl
+++ b/tp/t/results/indices/subentries.pl
@@ -1169,17 +1169,17 @@ $result_converted{'html_text'}->{'subentries'} = '<div 
class="top-level-extent"
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-B">B</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="cp-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#t_i_cp_letter-A"><b>A</b></a>
@@ -1199,13 +1199,13 @@ $result_converted{'html_text'}->{'subentries'} = '<div 
class="top-level-extent"
 <tr><th id="t_i_fn_letter-F">F</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 </div>
diff --git a/tp/t/results/indices/subentry_and_sortas.pl 
b/tp/t/results/indices/subentry_and_sortas.pl
index 3135f03ce6..3e8b01c7f7 100644
--- a/tp/t/results/indices/subentry_and_sortas.pl
+++ b/tp/t/results/indices/subentry_and_sortas.pl
@@ -678,7 +678,7 @@ $result_converted{'html_text'}->{'subentry_and_sortas'} = 
'<div class="top-level
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 </div>
@@ -688,7 +688,7 @@ $result_converted{'html_text'}->{'subentry_and_sortas'} = 
'<div class="top-level
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 </div>
diff --git a/tp/t/results/indices/subentry_and_sortas_spaces.pl 
b/tp/t/results/indices/subentry_and_sortas_spaces.pl
index 98033e3520..df23befa28 100644
--- a/tp/t/results/indices/subentry_and_sortas_spaces.pl
+++ b/tp/t/results/indices/subentry_and_sortas_spaces.pl
@@ -806,11 +806,11 @@ 
$result_converted{'html_text'}->{'subentry_and_sortas_spaces'} = '<div class="to
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="t_i_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb sort as c</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-1"><span 
class="index-entry-level-1"></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a href="#index-aaa">bbb sort as 
c</a></span>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter-index">chapter index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa-1"></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">bbb</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-3"><span 
class="index-entry-level-2">ccc</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-2"><span 
class="index-entry-level-2">ccc</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-aaa-3">ccc</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-aaa-2">ccc</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 </div>
diff --git a/tp/tests/layout/res_parser/formatting/formatting.html 
b/tp/tests/layout/res_parser/formatting/formatting.html
index e8196e3d6f..29d34bc31c 100644
--- a/tp/tests/layout/res_parser/formatting/formatting.html
+++ b/tp/tests/layout/res_parser/formatting/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_chm/chapter.html 
b/tp/tests/layout/res_parser/formatting_chm/chapter.html
index 45be57153a..74f995f644 100644
--- a/tp/tests/layout/res_parser/formatting_chm/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_chm/chapter.html
@@ -4389,7 +4389,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -4403,7 +4403,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -4411,7 +4411,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -4474,7 +4474,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -4746,15 +4746,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -4854,7 +4854,7 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_chm/chapter2.html 
b/tp/tests/layout/res_parser/formatting_chm/chapter2.html
index e0080de09e..05827fd01c 100644
--- a/tp/tests/layout/res_parser/formatting_chm/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_chm/chapter2.html
@@ -915,7 +915,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -929,7 +929,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="chapter.html">1 chapter</a></td></tr>
@@ -937,7 +937,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -1000,7 +1000,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -1270,15 +1270,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="formatting.html">Top 
section</a></td></tr>
@@ -1378,7 +1378,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
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 e9031ff1e2..69950eb697 100644
--- a/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a href="#index-aaa">bbb</a></span></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a—a</a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td> 
</td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td> 
</td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">b—b</td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c—c</span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c—c</a></span></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">d—dd</td><td> </td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e—ee</span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f—ff</span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f—ff</a></span></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>
 </td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>
 </td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>
 </td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">g—gg</td><td> </td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h—hh jjj</span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k—kk, 
l—ll</span></a></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k—kk, 
l—ll</a></span></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td> </td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td> </td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---bb</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ddd</code></td><td> 
</td><td class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ddd</code></td><td> 
</td><td class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ddd</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ggg</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh fjjj</code></span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, f---lll</code></span></a></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>xxx</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to:   </th><td><a 
class="summary-letter-printindex" href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a href="#index-aaa">bbb</a></span></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a—a</a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td> 
</td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td> 
</td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">b—b</td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c—c</span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c—c</a></span></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">d—dd</td><td> </td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e—ee</span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f—ff</span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f—ff</a></span></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>
 </td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>
 </td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>
 </td><td class="printindex-index-section"><a href="#Top">Top 
section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry">g—gg</td><td> </td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h—hh jjj</span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k—kk, 
l—ll</span></a></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k—kk, 
l—ll</a></span></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td> </td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td> </td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---bb</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ddd</code></td><td> 
</td><td class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ddd</code></td><td> 
</td><td class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ddd</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>f---ggg</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh fjjj</code></span></td><td> </td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, f---lll</code></span></a></td><td> 
</td><td class="printindex-index-section"><a href="#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td> </td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td> </td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><code>xxx</code></td><td> 
</td><td class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td> </td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to:   </th><td><a 
class="summary-letter-printindex" href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
index ea3b04534b..b4892016a5 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
+++ 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
@@ -4389,7 +4389,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&#8212;a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4403,7 +4403,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&#8212;b</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&#8212;c</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&#8212;c</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.xhtml#index-counting-entry">counting 
entry</a></td><td>&#160;</td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -4411,7 +4411,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&#8212;dd</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&#8212;ee</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&#8212;ff</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&#8212;ff</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4474,7 +4474,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&#8212;gg</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&#8212;hh jjj</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&#8212;kk, 
l&#8212;ll</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&#8212;kk, 
l&#8212;ll</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4746,15 +4746,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&#160;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed-1"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4854,7 +4854,7 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &#160; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
index b9caa1e925..655a1fa900 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
+++ 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
@@ -917,7 +917,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-a">a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-aaa">bbb</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-a_002d_002d_002da">a&#8212;a</a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -931,7 +931,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-b-4"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-b-5"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&#8212;b</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&#8212;c</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-b_002d_002d_002db">c&#8212;c</a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.xhtml#index-counting-entry">counting 
entry</a></td><td>&#160;</td><td class="printindex-index-section"><a 
href="chapter.xhtml#chapter">1 chapter</a></td></tr>
@@ -939,7 +939,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&#8212;dd</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&#8212;ee</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&#8212;ff</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-d_002d_002d_002ddd">f&#8212;ff</a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -1002,7 +1002,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&#8212;gg</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&#8212;hh jjj</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&#8212;kk, 
l&#8212;ll</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-g_002d_002d_002dgg">k&#8212;kk, 
l&#8212;ll</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -1272,15 +1272,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&#160;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed-1"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -1380,7 +1380,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-xxx"><code>zzz</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml#chapter">1 
chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &#160; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter.xhtml
 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter.xhtml
index 07e4d62eeb..5a7db53811 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter.xhtml
+++ 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter.xhtml
@@ -4390,7 +4390,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&#8212;a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4404,7 +4404,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&#8212;b</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&#8212;c</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&#8212;c</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.xhtml#index-counting-entry">counting 
entry</a></td><td>&#160;</td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -4412,7 +4412,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&#8212;dd</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&#8212;ee</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&#8212;ff</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&#8212;ff</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4475,7 +4475,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&#8212;gg</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&#8212;hh jjj</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&#8212;kk, 
l&#8212;ll</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&#8212;kk, 
l&#8212;ll</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4747,15 +4747,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&#160;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed-1"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -4855,7 +4855,7 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &#160; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
index be9ef1d3a0..774cb4556c 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
+++ 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/chapter2.xhtml
@@ -918,7 +918,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-a">a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-aaa">bbb</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-a_002d_002d_002da">a&#8212;a</a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -932,7 +932,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-b-4"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-b-5"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&#8212;b</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&#8212;c</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-b_002d_002d_002db">c&#8212;c</a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.xhtml#index-counting-entry">counting 
entry</a></td><td>&#160;</td><td class="printindex-index-section"><a 
href="chapter.xhtml">1 chapter</a></td></tr>
@@ -940,7 +940,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&#8212;dd</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&#8212;ee</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&#8212;ff</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-d_002d_002d_002ddd">f&#8212;ff</a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -1003,7 +1003,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&#8212;gg</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&#8212;hh jjj</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&#8212;kk, 
l&#8212;ll</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-g_002d_002d_002dgg">k&#8212;kk, 
l&#8212;ll</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -1273,15 +1273,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&#160;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.xhtml#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-copying-followed-1"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="formatting.xhtml">Top 
section</a></td></tr>
@@ -1381,7 +1381,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="chapter.xhtml">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.xhtml#index-xxx"><code>zzz</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="chapter.xhtml">1 
chapter</a></td></tr>
 <tr><td colspan="4"> </td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &#160; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_exotic/chapter.html 
b/tp/tests/layout/res_parser/formatting_exotic/chapter.html
index 83cfad4889..3a840a03b4 100644
--- a/tp/tests/layout/res_parser/formatting_exotic/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_exotic/chapter.html
@@ -4404,7 +4404,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4418,7 +4418,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
@@ -4426,7 +4426,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4489,7 +4489,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">chapter</a></td></tr>
@@ -4761,15 +4761,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4869,7 +4869,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_exotic/chapter2.html 
b/tp/tests/layout/res_parser/formatting_exotic/chapter2.html
index 26e71411a4..8e2df03acb 100644
--- a/tp/tests/layout/res_parser/formatting_exotic/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_exotic/chapter2.html
@@ -932,7 +932,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -946,7 +946,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="chapter.html">chapter</a></td></tr>
@@ -954,7 +954,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1017,7 +1017,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
@@ -1287,15 +1287,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1395,7 +1395,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
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 751d0115cd..b9ba0aab43 100644
--- a/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Aller &agrave;: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Aller &agrave;: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_html/formatting.html 
b/tp/tests/layout/res_parser/formatting_html/formatting.html
index e8196e3d6f..29d34bc31c 100644
--- a/tp/tests/layout/res_parser/formatting_html/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_html/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git 
a/tp/tests/layout/res_parser/formatting_html_no_texi2html/formatting.html 
b/tp/tests/layout/res_parser/formatting_html_no_texi2html/formatting.html
index fdde8f510e..9edb2b22b8 100644
--- a/tp/tests/layout/res_parser/formatting_html_no_texi2html/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_html_no_texi2html/formatting.html
@@ -4447,7 +4447,7 @@ Invalid use of @':
 <tr><th id="chapter_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top</a></td></tr>
@@ -4461,7 +4461,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
@@ -4469,7 +4469,7 @@ Invalid use of @':
 <tr><th id="chapter_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top</a></td></tr>
@@ -4532,7 +4532,7 @@ Invalid use of @':
 <tr><th id="chapter_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">chapter</a></td></tr>
@@ -4804,15 +4804,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code>:</td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code>:</td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top</a></td></tr>
@@ -4912,7 +4912,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter_fn_symbol-1"><b>-</b></a>
@@ -5081,7 +5081,7 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><th id="chapter2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top</a></td></tr>
@@ -5095,7 +5095,7 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
@@ -5103,7 +5103,7 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><th id="chapter2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top</a></td></tr>
@@ -5166,7 +5166,7 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><th id="chapter2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">chapter</a></td></tr>
@@ -5436,15 +5436,15 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code>:</td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code>:</td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a>:</td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top</a></td></tr>
@@ -5544,7 +5544,7 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_html_nodes/chapter.html 
b/tp/tests/layout/res_parser/formatting_html_nodes/chapter.html
index aae42e3708..c8d4762618 100644
--- a/tp/tests/layout/res_parser/formatting_html_nodes/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_html_nodes/chapter.html
@@ -4409,7 +4409,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4423,7 +4423,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.html#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -4431,7 +4431,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4494,7 +4494,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-index-entry-between-item-and-itemx">index entry 
between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4766,15 +4766,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4874,7 +4874,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_html_nodes/chapter2.html 
b/tp/tests/layout/res_parser/formatting_html_nodes/chapter2.html
index 22f9c63e19..3ff26dea74 100644
--- a/tp/tests/layout/res_parser/formatting_html_nodes/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_html_nodes/chapter2.html
@@ -932,7 +932,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -946,7 +946,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.html#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="chapter.html">1 chapter</a></td></tr>
@@ -954,7 +954,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1017,7 +1017,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-index-entry-between-item-and-itemx">index entry 
between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1287,15 +1287,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1395,7 +1395,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
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 1b77afb596..3f390e8dc0 100644
--- a/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
@@ -6565,7 +6565,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">aaa</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-aaa"><span class="index-entry-level-1" style="margin-left: 
0.5em">bbb</span></a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
@@ -6579,7 +6579,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">b&mdash;b</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-b_002d_002d_002db"><span class="index-entry-level-1" 
style="margin-left: 0.5em">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -6587,7 +6587,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">d&mdash;dd</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 
0.5em">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-d_002d_002d_002ddd"><span class="index-entry-level-2" 
style="margin-left: 1.0em">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
@@ -6650,7 +6650,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">g&mdash;gg</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em">h&mdash;hh 
jjj</span></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2" 
style="margin-left: 1.0em">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#Top">Top section</a></td></tr>
@@ -6922,15 +6922,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dbb"><span class="index-entry-level-1" 
style="margin-left: 
0.5em"><code>f---cc</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 
0.5em"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dddd"><span class="index-entry-level-2" 
style="margin-left: 1.0em"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dggg"><span class="index-entry-level-2" 
style="margin-left: 1.0em"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
@@ -7030,7 +7030,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>xxx</code></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-xxx"><span class="index-entry-level-1" style="margin-left: 
0.5em"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" style="text-decoration: none" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7273,7 +7273,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">aaa</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-aaa"><span class="index-entry-level-1" style="margin-left: 
0.5em">bbb</span></a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
@@ -7287,7 +7287,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">b&mdash;b</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-b_002d_002d_002db"><span class="index-entry-level-1" 
style="margin-left: 0.5em">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -7295,7 +7295,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">d&mdash;dd</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 
0.5em">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-d_002d_002d_002ddd"><span class="index-entry-level-2" 
style="margin-left: 1.0em">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
@@ -7358,7 +7358,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top">g&mdash;gg</td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em">h&mdash;hh 
jjj</span></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2" 
style="margin-left: 1.0em">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"><a href="#Top">Top section</a></td></tr>
@@ -7628,15 +7628,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dbb"><span class="index-entry-level-1" 
style="margin-left: 
0.5em"><code>f---cc</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 
0.5em"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dddd"><span class="index-entry-level-2" 
style="margin-left: 1.0em"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dggg"><span class="index-entry-level-2" 
style="margin-left: 1.0em"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-2" style="margin-left: 1.0em"><a 
href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a href="#Top">Top 
section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section" style="vertical-align: top"><a 
href="#Top">Top section</a></td></tr>
@@ -7736,7 +7736,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><code>xxx</code></td><td>&nbsp;</td><td class="printindex-index-section" 
style="vertical-align: top"></td></tr>
-<tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-xxx"><span class="index-entry-level-1" style="margin-left: 
0.5em"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry" style="vertical-align: 
top"><span class="index-entry-level-1" style="margin-left: 0.5em"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section" style="vertical-align: top"><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" style="text-decoration: none" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html 
b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
index f229b1fdcf..7a678a0122 100644
--- a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_nodes/chapter.html 
b/tp/tests/layout/res_parser/formatting_nodes/chapter.html
index aae42e3708..c8d4762618 100644
--- a/tp/tests/layout/res_parser/formatting_nodes/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_nodes/chapter.html
@@ -4409,7 +4409,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4423,7 +4423,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.html#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -4431,7 +4431,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4494,7 +4494,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-index-entry-between-item-and-itemx">index entry 
between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4766,15 +4766,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -4874,7 +4874,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_nodes/chapter2.html 
b/tp/tests/layout/res_parser/formatting_nodes/chapter2.html
index 22f9c63e19..3ff26dea74 100644
--- a/tp/tests/layout/res_parser/formatting_nodes/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_nodes/chapter2.html
@@ -932,7 +932,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -946,7 +946,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting_fot.html#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="chapter.html">1 chapter</a></td></tr>
@@ -954,7 +954,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1017,7 +1017,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-index-entry-between-item-and-itemx">index entry 
between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1287,15 +1287,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.html">Top section</a></td></tr>
@@ -1395,7 +1395,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
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 ab14e4b627..510ef2b957 100644
--- a/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&#8212;a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&#8212;b</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&#8212;c</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&#8212;c</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&#8212;dd</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&#8212;ee</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&#8212;ff</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&#8212;ff</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&#8212;gg</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&#8212;hh jjj</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&#8212;kk, 
l&#8212;ll</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&#8212;kk, 
l&#8212;ll</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&#160;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&#160;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &#160; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&#8212;a</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&#8212;b</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&#8212;c</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&#8212;c</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&#8212;dd</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&#8212;ee</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&#8212;ff</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&#8212;ff</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&#8212;gg</td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&#8212;hh jjj</span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&#8212;kk, 
l&#8212;ll</span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&#8212;kk, 
l&#8212;ll</a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&#160;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&#160;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&#160;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&#160;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&#160;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &#160; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git 
a/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html 
b/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html
index e8196e3d6f..29d34bc31c 100644
--- a/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
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 da4c5fdc72..e5129c98ed 100644
--- a/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/layout/res_parser/formatting_xhtml/formatting.html 
b/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
index a6792b484e..43a3ab488c 100644
--- a/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
@@ -6605,7 +6605,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6619,7 +6619,7 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -6627,7 +6627,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -6690,7 +6690,7 @@ Invalid use of @':
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -6962,15 +6962,15 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7070,7 +7070,7 @@ Invalid use of @':
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr/></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7313,7 +7313,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7327,7 +7327,7 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-counting-entry">counting entry</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
@@ -7335,7 +7335,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7398,7 +7398,7 @@ Menu comment
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#Top">Top section</a></td></tr>
@@ -7668,15 +7668,15 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#Top">Top section</a></td></tr>
@@ -7776,7 +7776,7 @@ Menu comment
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr/></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>
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 af64addf2a..62ebed8c31 100644
--- a/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
+++ b/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
@@ -4842,7 +4842,7 @@ $">
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
@@ -4856,7 +4856,7 @@ $">
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="sing_fot.htm#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -4864,7 +4864,7 @@ $">
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
@@ -4927,7 +4927,7 @@ $">
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg"><span class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter">1 chapter</a></td></tr>
@@ -5199,15 +5199,15 @@ $">
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
@@ -5307,7 +5307,7 @@ $">
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
diff --git a/tp/tests/tex_html/res_parser/formatting_singular/chapter2.html 
b/tp/tests/tex_html/res_parser/formatting_singular/chapter2.html
index 345f21c5fe..e703cb5678 100644
--- a/tp/tests/tex_html/res_parser/formatting_singular/chapter2.html
+++ b/tp/tests/tex_html/res_parser/formatting_singular/chapter2.html
@@ -957,7 +957,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a">a</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry">aaa</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-aaa"><span 
class="index-entry-level-1">bbb</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-aaa">bbb</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-a_002d_002d_002da">a&mdash;a</a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
@@ -971,7 +971,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">b&mdash;b</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-b_002d_002d_002db"><span 
class="index-entry-level-1">c&mdash;c</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-b_002d_002d_002db">c&mdash;c</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-C">C</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="sing_fot.htm#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="chapter.html">1 chapter</a></td></tr>
@@ -979,7 +979,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">d&mdash;dd</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">e&mdash;ee</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd"><span 
class="index-entry-level-2">f&mdash;ff</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-d_002d_002d_002ddd">f&mdash;ff</a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
@@ -1042,7 +1042,7 @@ th.sections-header-printindex {text-align:left}
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry">g&mdash;gg</td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1">h&mdash;hh jjj</span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg"><span 
class="index-entry-level-2">k&mdash;kk, 
l&mdash;ll</span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-g_002d_002d_002dgg">k&mdash;kk, 
l&mdash;ll</a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-I">I</th><td></td><td></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-index-entry-between-item-and-itemx">index 
entry between item and itemx</a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
@@ -1312,15 +1312,15 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-see-entry"><code 
class="code">f---aaa</code>, <em class="emph">See</em> <code 
class="code">f---bbb</code></td><td>&nbsp;</td><td 
class="printindex-index-see-entry-section"></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---bb</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><span 
class="index-entry-level-1"><code>f---cc</code></span></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---cc</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-see-also"><em class="emph">See also</em> 
f---ccc</td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ddd</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---eee</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dddd"><span 
class="index-entry-level-2"><code>ffff</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dddd"><code>ffff</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>f---ggg</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
 <tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><code>f---hhh 
fjjj</code></span></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-f_002d_002d_002dggg"><span 
class="index-entry-level-2"><code>f---kkk, 
f---lll</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-2"><a 
href="chapter.html#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></span></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
@@ -1420,7 +1420,7 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-X">X</th><td></td><td></td></tr>
 <tr><td></td><td 
class="printindex-index-entry"><code>xxx</code></td><td>&nbsp;</td><td 
class="printindex-index-section"></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><span 
class="index-entry-level-1"><code>zzz</code></span></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><span 
class="index-entry-level-1"><a 
href="chapter.html#index-xxx"><code>zzz</code></a></span></td><td>&nbsp;</td><td
 class="printindex-index-section"><a href="chapter.html">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table class="fn-letters-footer-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chapter-2_fn_symbol-1"><b>-</b></a>



reply via email to

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