help-texinfo
[Top][All Lists]
Advanced

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

Re: Relating multiple index entries to one table item


From: Gavin Smith
Subject: Re: Relating multiple index entries to one table item
Date: Wed, 23 Nov 2022 21:31:07 +0000

On Tue, Nov 22, 2022 at 11:07:15PM +0100, Patrice Dumas wrote:
> On Tue, Nov 22, 2022 at 09:49:31PM +0000, Gavin Smith wrote:
> > On Tue, Nov 22, 2022 at 10:23:24PM +0100, Patrice Dumas wrote:
> > > Maybe not important if there are other changes afterwards, but with the
> > > change, in HTML, the result is now invalid, as the index entries end up
> > > not associated with the index term <dt>, but after the index term.  This
> > > is not correct, as the outer <dl> should only contain <dl> and <dt>.  It
> 
> Should read, the outer <dl> should only contain <dt> and <dd>.

I've been working on this, and with my current code I have, with the
following input:

    @table @asis
    @item AAA
    @itemx BBB
    @vindex index1
    @vindex index2
    @vindex index3
    Hello
    
    @end table

the following output:

   <dl class="table">
   <dt id='index-index1'><span>AAA<br>BBB<a class="index-entry-id" 
id="index-index2"></a>
   <a class="index-entry-id" id="index-index3"></a>
   <a class="copiable-link" href='#index-index1'> &para;</a></span></dt>
   <dd><p>Hello
   </p>
   </dd>
   </dl>

(I have not sent my work-in-progress code because I doubt anybody wants to
see it.)

I think this works well, apart from the treatment of @itemx, which is no
longer its own <dt> element, which is questionable.  There may be
better ways than simply separating the @item and @itemx output with <br>.
I couldn't easily find documentation of the HTML <dl> that said it was
okay to have two <dt> elements following each other.

For reference, the output before this change was

<dl class="table">
<dt>AAA</dt>
<dt>BBB</dt>
<dd><a class="index-entry-id" id="index-index1"></a>
<a class="index-entry-id" id="index-index2"></a>
<a class="index-entry-id" id="index-index3"></a>
<p>Hello
</p>
</dd>
</dl>

which doesn't have the copiable link (which may be a good thing, if
the document author doesn't want this), but the anchors will scroll
the page to after the <dt> headings, leaving them not visible.

I made this change by adding a new conversion for the 'table_term' type
in HTML.pm, which outputs the <dt>, so that everything inside the
'table_term' (@item, @itemx and @?index) is output inside the <dt>.

This might be the wrong way of approaching this (hence my not sharing the
code).  If both @item and @itemx should produce their own <dt>, but they
are both children of the same 'table_term', then something else would need
to be done to get the index entries inside one of the <dt> elements.

It might work if there was some way of controlling the conversion more
inside 'table_term'.  When I implemented a conversion for 'table_term'
(by using a line

$default_types_conversion{'table_term'} = \&_convert_table_term_type;

along with a new function), the conversion function had the contents
already converted.





reply via email to

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