texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Tue, 8 Nov 2022 03:29:27 -0500 (EST)

branch: master
commit cf772b028c696fc58b42d17363e0334af5e5c7d4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Nov 4 20:11:08 2022 +0100

    Format @subentry in HTML similarly as in printed output
    
    * tp/Texinfo/Convert/Converter.pm (comma_index_subentries_tree),
    tp/Texinfo/Convert/HTML.pm (_convert_printindex_command):
    pass directly the first element with a possible subentry to
    comma_index_subentries_tree to be able to start frmo a subentry, not
    only from the main entry.
    Format subentries in HTML by indenting and not redoing the formatting
    of previous lines first levels, similar with Texinfo TeX.
---
 ChangeLog                                          |  12 ++
 tp/Texinfo/Convert/Converter.pm                    |   9 +-
 tp/Texinfo/Convert/HTML.pm                         | 130 ++++++++++++++++++---
 tp/Texinfo/Convert/Plaintext.pm                    |   3 +-
 tp/t/results/indices/seealso_duplicate.pl          |   5 +-
 tp/t/results/indices/sorted_subentries.pl          |  34 +++---
 tp/t/results/indices/subentries.pl                 |  22 +++-
 tp/t/results/indices/subentry_and_sortas.pl        |   6 +-
 tp/t/results/indices/subentry_and_sortas_spaces.pl |  10 +-
 .../layout/res_parser/formatting/formatting.html   |  58 ++++++---
 .../layout/res_parser/formatting_chm/chapter.html  |  30 +++--
 .../layout/res_parser/formatting_chm/chapter2.html |  30 +++--
 .../formatting_enable_encoding/formatting.html     |  58 ++++++---
 .../EPUB/xhtml/chapter.xhtml                       |  30 +++--
 .../EPUB/xhtml/chapter2.xhtml                      |  30 +++--
 .../EPUB/xhtml/chapter.xhtml                       |  30 +++--
 .../EPUB/xhtml/chapter2.xhtml                      |  30 +++--
 .../res_parser/formatting_exotic/chapter.html      |  30 +++--
 .../res_parser/formatting_exotic/chapter2.html     |  30 +++--
 .../res_parser/formatting_fr_icons/formatting.html |  58 ++++++---
 .../res_parser/formatting_html/formatting.html     |  58 ++++++---
 .../res_parser/formatting_html32/formatting.html   |  56 ++++++---
 .../formatting_html_no_texi2html/formatting.html   |  58 ++++++---
 .../res_parser/formatting_html_nodes/chapter.html  |  30 +++--
 .../res_parser/formatting_html_nodes/chapter2.html |  30 +++--
 .../formatting_inline_css/formatting.html          |  56 ++++++---
 .../res_parser/formatting_mathjax/formatting.html  |  58 ++++++---
 .../res_parser/formatting_nodes/chapter.html       |  30 +++--
 .../res_parser/formatting_nodes/chapter2.html      |  30 +++--
 .../formatting_numerical_entities/formatting.html  |  58 ++++++---
 .../formatting_weird_quotes/formatting.html        |  58 ++++++---
 .../res_parser/formatting_xhtml/formatting.html    |  58 ++++++---
 .../res_parser/formatting_singular/chapter.html    |  30 +++--
 .../res_parser/formatting_singular/chapter2.html   |  30 +++--
 34 files changed, 949 insertions(+), 336 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 92fb320050..208442fc0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-11-04  Patrice Dumas  <pertusus@free.fr>
+
+       Format @subentry in HTML similarly as in printed output
+
+       * tp/Texinfo/Convert/Converter.pm (comma_index_subentries_tree),
+       tp/Texinfo/Convert/HTML.pm (_convert_printindex_command):
+       pass directly the first element with a possible subentry to
+       comma_index_subentries_tree to be able to start frmo a subentry, not
+       only from the main entry.
+       Format subentries in HTML by indenting and not redoing the formatting
+       of previous lines first levels, similar with Texinfo TeX.
+
 2022-11-03  Patrice Dumas  <pertusus@free.fr>
 
        Also use subentries for index entries sorting in texi2any
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 5876a6ea2a..65dd89c138 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1385,13 +1385,12 @@ sub convert_accents($$$;$)
 
 # index sub-entries specified with @subentry, separated by commas.
 sub comma_index_subentries_tree {
-  my ($self, $entry) = @_;
+  my ($self, $current_entry) = @_;
 
   my @contents;
-  my $tmp = $entry->{'entry_element'};
-  while ($tmp->{'extra'} and $tmp->{'extra'}->{'subentry'}) {
-    $tmp = $tmp->{'extra'}->{'subentry'};
-    push @contents, {'text' => ', '}, $tmp->{'args'}->[0];
+  while ($current_entry->{'extra'} and 
$current_entry->{'extra'}->{'subentry'}) {
+    $current_entry = $current_entry->{'extra'}->{'subentry'};
+    push @contents, {'text' => ', '}, $current_entry->{'args'}->[0];
   }
   if (scalar(@contents)) {
     return {'contents' => \@contents};
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f75bbc50c7..a8f3bff13d 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2227,6 +2227,8 @@ my %css_element_class_styles = (
      'span.sansserif'     => 'font-family: sans-serif; font-weight: normal',
      'span.r'             => 'font-family: initial; font-weight: normal; 
font-style: normal',
      'span.w-nolinebreak-text'   => 'white-space: nowrap',
+     'span.index-entry-level-1'  => 'margin-left: 0.5em',
+     'span.index-entry-level-2'  => 'margin-left: 1.0em',
      'kbd.key'            => 'font-style: normal',
      'kbd.kbd'            => 'font-style: oblique',
      'strong.def-name'    => 'font-family: monospace; font-weight: bold; '
@@ -5289,12 +5291,22 @@ sub _convert_printindex_command($$$$)
     my $letter = $letter_entry->{'letter'};
     my $entries_text = '';
     my $entry_nr = -1;
+    # since we normalize, a different formatting will not trigger a new
+    # formatting of the main entry or a subentry level.  This is the
+    # same for Texinfo TeX
+    my $normalized_entry_levels = [];
     foreach my $index_entry_ref (@{$letter_entry->{'entries'}}) {
       # FIXME format instead of ignoring
       next if ($index_entry_ref->{'entry_element'}->{'extra'}
                and 
($index_entry_ref->{'entry_element'}->{'extra'}->{'seeentry'}
                     or 
$index_entry_ref->{'entry_element'}->{'extra'}->{'seealso'}));
       $entry_nr++;
+      next if ($self->get_conf('NO_TOP_NODE_OUTPUT')
+               and defined($index_entry_ref->{'entry_node'})
+               and $index_entry_ref->{'entry_node'}->{'extra'}
+               and $index_entry_ref->{'entry_node'}->{'extra'}->{'normalized'}
+               and $index_entry_ref->{'entry_node'}->{'extra'}->{'normalized'} 
eq 'Top');
+
       # to avoid double error messages, call 
convert_tree_new_formatting_context
       # below with a multiple_pass argument if an entry was already formatted 
once,
       # for example if there are multiple printindex.
@@ -5304,13 +5316,100 @@ sub _convert_printindex_command($$$$)
         $formatted_index_entries->{$index_entry_ref}++;
       }
 
-      # div.display {margin-left: 3.2em}
-      my $subentries_tree = 
$self->comma_index_subentries_tree($index_entry_ref);
-      my @entry_contents = @{$index_entry_ref->{'entry_content'}};
-      push @entry_contents, @{$subentries_tree->{'contents'}}
-        if (defined($subentries_tree));
-      my $entry_tree = {'contents' => \@entry_contents};
-      $entry_tree->{'type'} = '_code' if ($index_entry_ref->{'in_code'});
+      # determine the trees and normalized main entry and subentries, to be
+      # compared with the previous line normalized entries to determine
+      # what is already formatted as part of the previous lines and
+      # what levels should be added.  The last level is always formatted.
+      my @new_normalized_entry_levels;
+      my @entry_trees;
+      my $entry_ref_tree = {'contents' => $index_entry_ref->{'entry_content'}};
+      $entry_ref_tree->{'type'} = '_code' if ($index_entry_ref->{'in_code'});
+      $new_normalized_entry_levels[0]
+        = uc(Texinfo::Convert::NodeNameNormalization::convert_to_normalized(
+             $entry_ref_tree));
+      $entry_trees[0] = $entry_ref_tree;
+      my $subentry = $index_entry_ref->{'entry_element'};
+      my $subentry_level = 1;
+      my $subentries_max_level = 2;
+      while ($subentry->{'extra'} and $subentry->{'extra'}->{'subentry'}
+             and $subentry_level <= $subentries_max_level) {
+        $subentry = $subentry->{'extra'}->{'subentry'};
+        my @subentry_contents;
+        if ($subentry->{'args'} and $subentry->{'args'}->[0]
+            and $subentry->{'args'}->[0]->{'contents'}) {
+          @subentry_contents = @{$subentry->{'args'}->[0]->{'contents'}};
+        }
+        my $subentry_tree = {'contents' => \@subentry_contents};
+        $subentry_tree->{'type'} = '_code' if ($index_entry_ref->{'in_code'});
+        if ($subentry_level >= $subentries_max_level) {
+          # at the max, concatenate the remaining subentries
+          my $other_subentries_tree = 
$self->comma_index_subentries_tree($subentry);
+          push @{$subentry_tree->{'contents'}},
+             @{$other_subentries_tree->{'contents'}}
+                if defined($other_subentries_tree);
+        } else {
+          push @new_normalized_entry_levels,
+            uc(Texinfo::Convert::NodeNameNormalization::convert_to_normalized(
+              $subentry_tree));
+        }
+        push @entry_trees, $subentry_tree;
+        $subentry_level ++;
+      }
+      #print STDERR join('|', @new_normalized_entry_levels)."\n";
+      # last entry, always converted, associated to chapter/node and
+      # with an hyperlinh
+      my $entry_tree = pop @entry_trees;
+      # indentation level of the last entry
+      my $entry_level = 0;
+
+      # format the leading entries when there are subentries.
+      # Each on a line with increasing indentation, no hyperlink.
+      if (scalar(@entry_trees) > 0) {
+        # find the level not already formatted as part of the previous lines
+        my $starting_subentry_level = 0;
+        foreach my $subentry_tree (@entry_trees) {
+          if ((scalar(@$normalized_entry_levels) > $starting_subentry_level)
+               and $normalized_entry_levels->[$starting_subentry_level]
+                 eq $new_normalized_entry_levels[$starting_subentry_level]) {
+          } else {
+            last;
+          }
+          $starting_subentry_level ++;
+        }
+        $entry_level = $starting_subentry_level;
+        foreach my $level ($starting_subentry_level .. scalar(@entry_trees)-1) 
{
+          my $entry;
+          if ($formatted_index_entries->{$index_entry_ref} > 1) {
+            # call with multiple_pass argument
+            $entry = 
$self->convert_tree_new_formatting_context($entry_trees[$level],
+                   "index $index_name l $letter index entry $entry_nr subentry 
$level",
+                   "index formatted 
$formatted_index_entries->{$index_entry_ref}")
+          } else {
+            $entry = $self->convert_tree($entry_trees[$level],
+                  "index $index_name l $letter index entry $entry_nr subentry 
$level");
+          }
+          $entry = '<code>' .$entry .'</code>' if 
($index_entry_ref->{'in_code'});
+          # indent
+          if ($level > 0) {
+            my $open = $self->html_attribute_class('span', 
["index-entry-level-$level"]);
+            if ($open ne '') {
+              $open .= '>';
+              $entry = $open.$entry.'</span>';
+            }
+          }
+          $entries_text .= '<tr><td></td>'
+           # FIXME same class used for leading element of the entry and
+           # last element of the entry.  Could be different.
+           .$self->html_attribute_class('td', ["$cmdname-index-entry"]).'>'
+           . $entry .
+           # following is empty, not sure if useful
+           '</td><td>'.$self->get_info('non_breaking_space').'</td>'
+            .$self->html_attribute_class('td', ["$cmdname-index-section"]).'>';
+          $entries_text .= "</td></tr>\n";
+
+          $entry_level = $level+1;
+        }
+      }
 
       my $entry;
       if ($formatted_index_entries->{$index_entry_ref} > 1) {
@@ -5323,13 +5422,18 @@ sub _convert_printindex_command($$$$)
                             "index $index_name l $letter index entry 
$entry_nr");
       }
 
-      next if ($entry !~ /\S/);
-      next if ($self->get_conf('NO_TOP_NODE_OUTPUT')
-               and defined($index_entry_ref->{'entry_node'})
-               and $index_entry_ref->{'entry_node'}->{'extra'}
-               and $index_entry_ref->{'entry_node'}->{'extra'}->{'normalized'}
-               and $index_entry_ref->{'entry_node'}->{'extra'}->{'normalized'} 
eq 'Top');
+      next if ($entry !~ /\S/ and $entry_level == 0);
+
+      $normalized_entry_levels = [@new_normalized_entry_levels];
       $entry = '<code>' .$entry .'</code>' if ($index_entry_ref->{'in_code'});
+      # 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>';
+        }
+      }
       my $entry_href = 
$self->command_href($index_entry_ref->{'entry_element'});
       my $associated_command;
       if ($self->get_conf('NODE_NAME_IN_INDEX')) {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 949bba1b84..cabb4244d8 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1390,7 +1390,8 @@ sub process_printindex($$;$)
   foreach my $entry (@{$self->{'index_entries'}->{$index_name}}) {
     next if ($ignored_entries{$entry});
     my $entry_tree = {'contents' => $entry->{'entry_content'}};
-    my $subentries_tree = $self->comma_index_subentries_tree($entry);
+    my $subentries_tree
+       = $self->comma_index_subentries_tree($entry->{'entry_element'});
     if ($entry->{'in_code'}) {
       $entry_tree->{'type'} = '_code';
       $subentries_tree->{'type'} = '_code'
diff --git a/tp/t/results/indices/seealso_duplicate.pl 
b/tp/t/results/indices/seealso_duplicate.pl
index 820d22928d..a8ea2c4462 100644
--- a/tp/t/results/indices/seealso_duplicate.pl
+++ b/tp/t/results/indices/seealso_duplicate.pl
@@ -397,8 +397,9 @@ $result_converted{'html_text'}->{'seealso_duplicate'} = 
'<h1 class="node" id="To
 <tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
 <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"><a href="#index-awk"><code 
class="command">awk</code>, POSIX and</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"><code 
class="command">awk</code>, POSIX and</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"><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 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 22436cb062..dae36f873d 100644
--- a/tp/t/results/indices/sorted_subentries.pl
+++ b/tp/t/results/indices/sorted_subentries.pl
@@ -2196,27 +2196,31 @@ $result_converted{'html_text'}->{'sorted_subentries'} = 
'<div class="top-level-e
 <tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
 <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"><a href="#index-aa">aa, 
bb</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">aa, 
dd</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-ab">ab, 
cc</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">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">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 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"><a href="#index-bb">bb, 
cc</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">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 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">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-1">hhh, 
jjj</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">&lsquo;<samp class="samp">hhh</samp>&rsquo;, 
jjj</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">hhh, 
jjj, lll</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">hhh, jjj, 
lll</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">hhh, 
jjj, lll</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">hhh, 
jjj, lll, ppp</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"><kbd 
class="kbd">hhh</kbd>, <small class="sc">JJJ</small>, <a class="email" 
href="mailto:jjj";>mymail</a></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">hhh, 
k</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">hhh, 
k, nnn</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-12">hhh, 
l, third</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">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"><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 d8f0a7d9a9..ccaa308676 100644
--- a/tp/t/results/indices/subentries.pl
+++ b/tp/t/results/indices/subentries.pl
@@ -1168,13 +1168,18 @@ $result_converted{'html_text'}->{'subentries'} = '<div 
class="top-level-extent"
 <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-index">chapter 
index</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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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">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 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"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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 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"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -1193,9 +1198,14 @@ $result_converted{'html_text'}->{'subentries'} = '<div 
class="top-level-extent"
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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"><a 
href="#index-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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"><a 
href="#index-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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 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 7f7e7efa4a..3135f03ce6 100644
--- a/tp/t/results/indices/subentry_and_sortas.pl
+++ b/tp/t/results/indices/subentry_and_sortas.pl
@@ -677,7 +677,8 @@ $result_converted{'html_text'}->{'subentry_and_sortas'} = 
'<div class="top-level
 <tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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">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 colspan="4"> <hr></td></tr>
 </table>
 </div>
@@ -686,7 +687,8 @@ $result_converted{'html_text'}->{'subentry_and_sortas'} = 
'<div class="top-level
 <tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
 <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"><a 
href="#index-xxx"><code>xxx, zzz</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>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 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 6f3b8b79c9..98033e3520 100644
--- a/tp/t/results/indices/subentry_and_sortas_spaces.pl
+++ b/tp/t/results/indices/subentry_and_sortas_spaces.pl
@@ -805,10 +805,12 @@ 
$result_converted{'html_text'}->{'subentry_and_sortas_spaces'} = '<div class="to
 <tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
 <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"><a href="#index-aaa">aaa, bbb 
sort as c</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">aaa, 
</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-3">aaa, 
bbb, ccc</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">aaa, 
bbb, ccc</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">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">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 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 b19ddf3488..86d9c314c2 100644
--- a/tp/tests/layout/res_parser/formatting/formatting.html
+++ b/tp/tests/layout/res_parser/formatting/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 cf162cd1a6..45e7cc17e1 100644
--- a/tp/tests/layout/res_parser/formatting_chm/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_chm/chapter.html
@@ -856,6 +856,8 @@ p.flushleft-paragraph {text-align:left}
 p.flushright-paragraph {text-align:right}
 pre.display-preformatted {font-family: inherit}
 pre.format-preformatted {font-family: inherit}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
 span:hover a.copiable-link {visibility: visible}
@@ -4382,7 +4384,8 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4394,13 +4397,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-b-2"><code>b</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="#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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -4459,7 +4465,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -4729,9 +4737,14 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4830,7 +4843,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 e5209ebe86..94975146c7 100644
--- a/tp/tests/layout/res_parser/formatting_chm/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_chm/chapter2.html
@@ -847,6 +847,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
 th.entries-header-printindex {text-align:left}
@@ -911,7 +913,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <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"><a 
href="chapter.html#index-aaa">aaa, bbb</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"><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>
@@ -923,13 +926,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.html#index-titlepage-b-2"><code>b</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="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"><a 
href="chapter.html#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -988,7 +994,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, 
k&mdash;kk, l&mdash;ll</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">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 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>
@@ -1256,9 +1264,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1357,7 +1370,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><code>xxx, zzz</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"><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 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 5e184f38f9..bea44f8235 100644
--- a/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b—b, c—c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d—dd, e—ee, f—ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g—gg, h—hh jjj, k—kk, l—ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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> </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-f_002d_002d_002dbb"><code>f---bb, f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b—b, c—c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d—dd, e—ee, f—ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g—gg, h—hh jjj, k—kk, l—ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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> </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-f_002d_002d_002dbb"><code>f---bb, f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 690dcef58f..b8fbc6f68d 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
@@ -856,6 +856,8 @@ p.flushleft-paragraph {text-align:left}
 p.flushright-paragraph {text-align:right}
 pre.display-preformatted {font-family: inherit}
 pre.format-preformatted {font-family: inherit}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
 strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
@@ -4382,7 +4384,8 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4394,13 +4397,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-b-2"><code>b</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="#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"><a 
href="#index-b_002d_002d_002db">b&#8212;b, c&#8212;c</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 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>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&#8212;dd, e&#8212;ee, 
f&#8212;ff</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">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"><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>
@@ -4459,7 +4465,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&#8212;gg, h&#8212;hh jjj, k&#8212;kk, 
l&#8212;ll</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">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 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>
@@ -4729,9 +4737,14 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_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>&#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-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4830,7 +4843,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 0cf9d95f2f..7fb5b8149f 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
@@ -848,6 +848,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
 th.entries-header-printindex {text-align:left}
@@ -913,7 +915,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <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"><a 
href="chapter.xhtml#index-aaa">aaa, bbb</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"><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>
@@ -925,13 +928,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-b-2"><code>b</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="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"><a 
href="chapter.xhtml#index-b_002d_002d_002db">b&#8212;b, 
c&#8212;c</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 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>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-d_002d_002d_002ddd">d&#8212;dd, e&#8212;ee, 
f&#8212;ff</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">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"><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>
@@ -990,7 +996,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-g_002d_002d_002dgg">g&#8212;gg, h&#8212;hh jjj, 
k&#8212;kk, l&#8212;ll</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">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 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>
@@ -1258,9 +1266,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1359,7 +1372,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-xxx"><code>xxx, zzz</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"><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 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 3c9e9e3233..ce08946b67 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
@@ -856,6 +856,8 @@ p.flushleft-paragraph {text-align:left}
 p.flushright-paragraph {text-align:right}
 pre.display-preformatted {font-family: inherit}
 pre.format-preformatted {font-family: inherit}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
 strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
@@ -4383,7 +4385,8 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4395,13 +4398,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-b-2"><code>b</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="#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"><a 
href="#index-b_002d_002d_002db">b&#8212;b, c&#8212;c</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 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>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&#8212;dd, e&#8212;ee, 
f&#8212;ff</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">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"><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>
@@ -4460,7 +4466,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&#8212;gg, h&#8212;hh jjj, k&#8212;kk, 
l&#8212;ll</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">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 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>
@@ -4730,9 +4738,14 @@ Invalid use of @':
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-1_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>&#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-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4831,7 +4844,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 d858fa979c..a9de8846e4 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
@@ -848,6 +848,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
 th.entries-header-printindex {text-align:left}
@@ -914,7 +916,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <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"><a 
href="chapter.xhtml#index-aaa">aaa, bbb</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"><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>
@@ -926,13 +929,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="formatting.xhtml#index-titlepage-b-2"><code>b</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="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"><a 
href="chapter.xhtml#index-b_002d_002d_002db">b&#8212;b, 
c&#8212;c</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 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>
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-d_002d_002d_002ddd">d&#8212;dd, e&#8212;ee, 
f&#8212;ff</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">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"><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>
@@ -991,7 +997,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-g_002d_002d_002dgg">g&#8212;gg, h&#8212;hh jjj, 
k&#8212;kk, l&#8212;ll</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">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 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>
@@ -1259,9 +1267,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> </td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.xhtml#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1360,7 +1373,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.xhtml#index-xxx"><code>xxx, zzz</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"><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 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 20d7b600c7..52db0947a4 100644
--- a/tp/tests/layout/res_parser/formatting_exotic/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_exotic/chapter.html
@@ -856,6 +856,8 @@ p.flushleft-paragraph {text-align:left}
 p.flushright-paragraph {text-align:right}
 pre.display-preformatted {font-family: inherit}
 pre.format-preformatted {font-family: inherit}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -4397,7 +4399,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4409,13 +4412,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -4474,7 +4480,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -4744,9 +4752,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4845,7 +4858,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 1967af8151..fdc3634c4f 100644
--- a/tp/tests/layout/res_parser/formatting_exotic/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_exotic/chapter2.html
@@ -847,6 +847,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
@@ -928,7 +930,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="chapter.html#index-aaa">aaa, bbb</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"><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>
@@ -940,13 +943,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-b-2"><code>b</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="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"><a 
href="chapter.html#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -1005,7 +1011,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, 
k&mdash;kk, l&mdash;ll</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">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 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>
@@ -1273,9 +1281,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1374,7 +1387,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><code>xxx, zzz</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"><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 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 e92de14c54..db8a0d34ad 100644
--- a/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 b19ddf3488..86d9c314c2 100644
--- a/tp/tests/layout/res_parser/formatting_html/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_html/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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_html32/formatting.html 
b/tp/tests/layout/res_parser/formatting_html32/formatting.html
index 4ca8811576..87acfda1ef 100644
--- a/tp/tests/layout/res_parser/formatting_html32/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_html32/formatting.html
@@ -6427,7 +6427,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td><a href="#index-a">a</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
-<tr><td></td><td><a href="#index-aaa">aaa, bbb</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>aaa</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a href="#index-aaa">bbb</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-a_002d_002d_002da">a--a</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
@@ -6439,13 +6440,16 @@ Invalid use of @':
 <tr><td></td><td><a 
href="#index-titlepage-b-2"><code>b</code></a></td><td>&nbsp;</td><td><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
-<tr><td></td><td><a href="#index-b_002d_002d_002db">b--b, 
c--c</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>b--b</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-b_002d_002d_002db">c--c</a></td><td>&nbsp;</td><td><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><a href="#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td><a href="#index-d_002d_002d_002ddd">d--dd, e--ee, 
f--ff</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>d--dd</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td>e--ee</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-d_002d_002d_002ddd">f--ff</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
@@ -6504,7 +6508,9 @@ Invalid use of @':
 <tr><td></td><td><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-G">G</th><td></td><td></td></tr>
-<tr><td></td><td><a href="#index-g_002d_002d_002dgg">g--gg, h--hh jjj, k--kk, 
l--ll</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>g--gg</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td>h--hh jjj</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a href="#index-g_002d_002d_002dgg">k--kk, 
l--ll</a></td><td>&nbsp;</td><td><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><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td><a href="#Top">Top 
section</a></td></tr>
@@ -6774,9 +6780,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-F">F</th><td></td><td></td></tr>
 <tr><td></td><td><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
-<tr><td></td><td><a href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
-<tr><td></td><td><a href="#index-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
-<tr><td></td><td><a href="#index-f_002d_002d_002dggg"><code>f---ggg, f---hhh 
fjjj, f---kkk, f---lll</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td><code>f---bb</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td><code>f---ddd</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><code>f---eee</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td><code>f---ggg</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><code>f---hhh fjjj</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
@@ -6875,7 +6886,8 @@ Invalid use of @':
 <tr><td></td><td><a 
href="#index-truc-3"><code>truc</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <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><a href="#index-xxx"><code>xxx, 
zzz</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td><code>xxx</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-xxx"><code>zzz</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table><tr><th>Jump to: &nbsp; </th><td><a 
href="#chapter-1_fn_symbol-1"><b>-</b></a>
@@ -7117,7 +7129,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-A">A</th><td></td><td></td></tr>
 <tr><td></td><td><a href="#index-a">a</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
-<tr><td></td><td><a href="#index-aaa">aaa, bbb</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>aaa</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a href="#index-aaa">bbb</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-a_002d_002d_002da">a--a</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-titlepage-a_002d_002dasis"><code>a--asis</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
@@ -7129,13 +7142,16 @@ Menu comment
 <tr><td></td><td><a 
href="#index-titlepage-b-2"><code>b</code></a></td><td>&nbsp;</td><td><a 
href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-b-4"><code>b</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-b-5"><code>b</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
-<tr><td></td><td><a href="#index-b_002d_002d_002db">b--b, 
c--c</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>b--b</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-b_002d_002d_002db">c--c</a></td><td>&nbsp;</td><td><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><a href="#index-counting-entry">counting 
entry</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td><a href="#index-d_002d_002d_002ddd">d--dd, e--ee, 
f--ff</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>d--dd</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td>e--ee</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-d_002d_002d_002ddd">f--ff</a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-d_002d_002defcv_005fname-1"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-titlepage-d_002d_002defcv_005fname"><code>d--efcv_name</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
@@ -7194,7 +7210,9 @@ Menu comment
 <tr><td></td><td><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-G">G</th><td></td><td></td></tr>
-<tr><td></td><td><a href="#index-g_002d_002d_002dgg">g--gg, h--hh jjj, k--kk, 
l--ll</a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td>g--gg</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td>h--hh jjj</td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a href="#index-g_002d_002d_002dgg">k--kk, 
l--ll</a></td><td>&nbsp;</td><td><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><a 
href="#index-copying-index-entry-between-item-and-itemx">index entry between 
item and itemx</a></td><td>&nbsp;</td><td><a href="#Top">Top 
section</a></td></tr>
@@ -7462,9 +7480,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <tr><td></td><td><a 
href="#index-f_002d_002d_002daa"><code>f---aa</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
-<tr><td></td><td><a href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
-<tr><td></td><td><a href="#index-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
-<tr><td></td><td><a href="#index-f_002d_002d_002dggg"><code>f---ggg, f---hhh 
fjjj, f---kkk, f---lll</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
+<tr><td></td><td><code>f---bb</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-f_002d_002d_002dbb"><code>f---cc</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td><code>f---ddd</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><code>f---eee</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-f_002d_002d_002dddd"><code>ffff</code></a></td><td>&nbsp;</td><td><a
 href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td><code>f---ggg</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><code>f---hhh fjjj</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a href="#index-f_002d_002d_002dggg"><code>f---kkk, 
f---lll</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 
chapter</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-followed"><code>followed</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-copying-followed-1"><code>followed</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
 <tr><td></td><td><a 
href="#index-titlepage-followed"><code>followed</code></a></td><td>&nbsp;</td><td><a
 href="#Top">Top section</a></td></tr>
@@ -7563,7 +7586,8 @@ Menu comment
 <tr><td></td><td><a 
href="#index-truc-3"><code>truc</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <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><a href="#index-xxx"><code>xxx, 
zzz</code></a></td><td>&nbsp;</td><td><a href="#chapter">1 chapter</a></td></tr>
+<tr><td></td><td><code>xxx</code></td><td>&nbsp;</td><td></td></tr>
+<tr><td></td><td><a 
href="#index-xxx"><code>zzz</code></a></td><td>&nbsp;</td><td><a 
href="#chapter">1 chapter</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 </table>
 <table><tr><th>Jump to: &nbsp; </th><td><a 
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 2c3379a299..5300ff9987 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
@@ -861,6 +861,8 @@ p.flushleft-paragraph {text-align:left}
 p.flushright-paragraph {text-align:right}
 pre.display-preformatted {font-family: inherit}
 pre.format-preformatted {font-family: inherit}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
 span:hover a.copiable-link {visibility: visible}
@@ -4440,7 +4442,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4452,13 +4455,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</code></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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -4517,7 +4523,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a>:</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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -4787,9 +4795,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter_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">chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4888,7 +4901,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a>:</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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -5056,7 +5070,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -5068,13 +5083,16 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</code></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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -5133,7 +5151,9 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a>:</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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -5401,9 +5421,14 @@ 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-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">chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -5502,7 +5527,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a>:</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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 cbe15ee7f7..a84096efcc 100644
--- a/tp/tests/layout/res_parser/formatting_html_nodes/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_html_nodes/chapter.html
@@ -859,6 +859,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -4402,7 +4404,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4414,13 +4417,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -4479,7 +4485,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -4749,9 +4757,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4850,7 +4863,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 b4241e0b5d..66ae42f3cf 100644
--- a/tp/tests/layout/res_parser/formatting_html_nodes/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_html_nodes/chapter2.html
@@ -847,6 +847,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
@@ -928,7 +930,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="chapter.html#index-aaa">aaa, bbb</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"><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>
@@ -940,13 +943,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-b-2"><code>b</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="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"><a 
href="chapter.html#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -1005,7 +1011,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, 
k&mdash;kk, l&mdash;ll</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">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 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>
@@ -1273,9 +1281,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1374,7 +1387,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><code>xxx, zzz</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"><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 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 c65d5e044b..536945a49f 100644
--- a/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
@@ -6558,7 +6558,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-aaa">aaa, bbb</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"><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>
@@ -6570,13 +6571,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6635,7 +6639,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</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 colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6905,9 +6911,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7006,7 +7017,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-truc-3"><code>truc</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 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"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7248,7 +7260,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-aaa">aaa, bbb</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"><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>
@@ -7260,13 +7273,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7325,7 +7341,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</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 colspan="4"> <hr></td></tr>
 <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"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7593,9 +7611,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry" style="vertical-align: top"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7694,7 +7717,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry" style="vertical-align: top"><a 
href="#index-truc-3"><code>truc</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 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"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 7df1f66798..86c3361c07 100644
--- a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 cbe15ee7f7..a84096efcc 100644
--- a/tp/tests/layout/res_parser/formatting_nodes/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_nodes/chapter.html
@@ -859,6 +859,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -4402,7 +4404,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4414,13 +4417,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -4479,7 +4485,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -4749,9 +4757,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -4850,7 +4863,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 b4241e0b5d..66ae42f3cf 100644
--- a/tp/tests/layout/res_parser/formatting_nodes/chapter2.html
+++ b/tp/tests/layout/res_parser/formatting_nodes/chapter2.html
@@ -847,6 +847,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
@@ -928,7 +930,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="chapter.html#index-aaa">aaa, bbb</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"><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>
@@ -940,13 +943,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.html#index-titlepage-b-2"><code>b</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="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"><a 
href="chapter.html#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -1005,7 +1011,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, 
k&mdash;kk, l&mdash;ll</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">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 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>
@@ -1273,9 +1281,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1374,7 +1387,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><code>xxx, zzz</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"><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 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 2cb8452876..bb9c42236d 100644
--- a/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&#8212;b, c&#8212;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&#8212;dd, e&#8212;ee, 
f&#8212;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&#8212;gg, h&#8212;hh jjj, k&#8212;kk, 
l&#8212;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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>&#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-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&#8212;b, c&#8212;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&#8212;dd, e&#8212;ee, 
f&#8212;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&#8212;gg, h&#8212;hh jjj, k&#8212;kk, 
l&#8212;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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>&#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-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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_weird_quotes/formatting.html 
b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
index edb7ebea70..a254bfffc0 100644
--- a/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 1c85f62eef..fdb621c436 100644
--- a/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
@@ -861,6 +861,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.program-in-footer {font-size: smaller}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
@@ -6596,7 +6598,8 @@ Invalid use of @':
 <tr><td colspan="4"> <hr/></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -6608,13 +6611,16 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -6673,7 +6679,9 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -6943,9 +6951,14 @@ Invalid use of @':
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7044,7 +7057,8 @@ Invalid use of @':
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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>
@@ -7286,7 +7300,8 @@ Menu comment
 <tr><td colspan="4"> <hr/></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -7298,13 +7313,16 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-titlepage-b-2"><code>b</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-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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -7363,7 +7381,9 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -7631,9 +7651,14 @@ Menu comment
 <tr><td colspan="4"> <hr/></td></tr>
 <tr><th id="chapter-2_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -7732,7 +7757,8 @@ Menu comment
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 5f4392577f..59821f5495 100644
--- a/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
+++ b/tp/tests/tex_html/res_parser/formatting_singular/chapter.html
@@ -860,6 +860,8 @@ pre.format-preformatted {font-family: inherit}
 pre.menu-comment-preformatted {font-family: serif}
 pre.menu-entry-description-preformatted {font-family: serif; display: inline}
 pre.menu-preformatted {font-family: serif}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 span.r {font-family: initial; font-weight: normal; font-style: normal}
 span.sansserif {font-family: sans-serif; font-weight: normal}
 span:hover a.copiable-link {visibility: visible}
@@ -4835,7 +4837,8 @@ $">
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a href="#index-aaa">aaa, 
bbb</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"><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>
@@ -4847,13 +4850,16 @@ $">
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-b-2"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
 <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"><a 
href="#index-b_002d_002d_002db">b&mdash;b, c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -4912,7 +4918,9 @@ $">
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, k&mdash;kk, 
l&mdash;ll</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">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 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>
@@ -5182,9 +5190,14 @@ $">
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-1_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">1 chapter</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, f---kkk, 
f---lll</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"><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"><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"><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"><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>
@@ -5283,7 +5296,8 @@ $">
 <tr><td></td><td class="printindex-index-entry"><a 
href="#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</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"><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 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 c666c3beb9..c0c4bb9c44 100644
--- a/tp/tests/tex_html/res_parser/formatting_singular/chapter2.html
+++ b/tp/tests/tex_html/res_parser/formatting_singular/chapter2.html
@@ -848,6 +848,8 @@ g-roupe
 <!--
 a.summary-letter-printindex {text-decoration: none}
 h1.centerchap {text-align:center}
+span.index-entry-level-1 {margin-left: 0.5em}
+span.index-entry-level-2 {margin-left: 1.0em}
 td.printindex-index-entry {vertical-align: top}
 td.printindex-index-section {vertical-align: top}
 th.entries-header-printindex {text-align:left}
@@ -953,7 +955,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <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"><a 
href="chapter.html#index-aaa">aaa, bbb</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"><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>
@@ -965,13 +968,16 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="index.htm#index-titlepage-b-2"><code>b</code></a></td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="index.htm">Top section</a></td></tr>
 <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"><a 
href="chapter.html#index-b_002d_002d_002db">b&mdash;b, 
c&mdash;c</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 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>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_cp_letter-D">D</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002d_002ddd">d&mdash;dd, e&mdash;ee, 
f&mdash;ff</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">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"><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>
@@ -1030,7 +1036,9 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-d_002d_002defvr_005fname-1"><code>d--efvr_name</code></a></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-G">G</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-g_002d_002d_002dgg">g&mdash;gg, h&mdash;hh jjj, 
k&mdash;kk, l&mdash;ll</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">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 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>
@@ -1298,9 +1306,14 @@ th.sections-header-printindex {text-align:left}
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="chapter-2_fn_letter-F">F</th><td></td><td></td></tr>
 <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-entry"><a 
href="chapter.html#index-f_002d_002d_002dbb"><code>f---bb, 
f---cc</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-f_002d_002d_002dddd"><code>f---ddd, f---eee, 
ffff</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-f_002d_002d_002dggg"><code>f---ggg, f---hhh fjjj, 
f---kkk, f---lll</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"><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"><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"><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"><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>
@@ -1399,7 +1412,8 @@ th.sections-header-printindex {text-align:left}
 <tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-truc-3"><code>truc</code></a></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_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="chapter.html#index-xxx"><code>xxx, zzz</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"><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 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]