On Sat, Nov 19, 2022 at 04:09:05AM -0800, Per Bothner wrote: > > On 11/19/22 01:22, Patrice Dumas wrote: > > Any proposition for a better formatting? Any idea on how to help > > javascript-ing, maybe with a custom attribute with the full entry with > > commas separating the subentries? > > That would be fairly easy to deal with. > However, JavaScript should be able figure it out without that. > It can look at sibling entries wihout too much pain, > as long as there is a clean well-defined structure: > It is easy to tell entries, subentries, and subsubentries apart, > and they're in the "obvious" order.
I think that they are in the "obvious" order, organised as a tree. There is a way to tell entries, subentries, and subsubentries apart: subentries contain span.index-entry-level-1, subsubentries contain span.index-entry-level-2, and entries do not contain such a span. Notice that there a re different cases for the entries and sub/subsubentries relationships. If the entries are only @cindex main @subentry lvl one @subentry lvl two Then there will be a first row for main, without <a>, then one row for 'lvl one', in span.index-entry-level-1, still no <a>, and the third row with span.index-entry-level-2 containing <a> and 'lvl two' within the <a>. However, if the entries are @cindex main @cindex main @subentry lvl one @cindex main @subentry lvl one @subentry lvl two Then there will be three row, too, but all the three rows will have a <a> linking to an index entry, in a span.index-entry-level-1 for 'lvl one' and in a span.index-entry-level-2 for 'lvl two'. Not sure that it makes a difference, but there can be duplicate entries at any level. Also there can be entries interspeded (logically) with more subsubentries levels, for example @cindex hhh @cindex hhh @subentry jjj @subentry lll @cindex hhh @subentry mmm @cindex hhh @subentry mmm @subentry nnn leads to hhh with <a> jjj no <a> lll with <a> mmm with <a> nnn with <a> -- Pat