On Wed, Mar 22, 2023 at 02:10:44AM +0000, Gavin Smith wrote: > This may be ok but it might not be necessary if we can tweak the > parse tree with some transformation to associate index entries > in @table appropriately. I doubt I'll have time to look into this > issue deeply enough until the weekend.
I did it in the tree transformations. At the moment, it's only HTML output that is affected. This was an important issue so that following an index entry in HTML would scroll the page so that the <dt> heading was visible. It's harder to do in the parser itself because of the possibility of @itemx, each use of which leads to a separate <dd> element in HTML output which we want to be able to close, but the index anchor should be inside a <dd>. Example input: @table @asis @cindex Eeny @item one @cindex Meeny @cindex Miney aaa @item two bbb @end table Output: <dl class="table"> <dt><a class="index-entry-id" id="index-Miney"></a> <a class="index-entry-id" id="index-Meeny"></a> <a id="index-Eeny"></a><span>one<a class="copiable-link" href="#index-Eeny"> ¶</a></span></dt> <dd><p>aaa </p></dd> <dt>two</dt> <dd><p>bbb </p></dd> </dl> The index entries after @item aren't used for the copiable link, although this could be changed. If this looks ok I'll try to add tests to the test suite using this transformation.