xml2rfc icon indicating copy to clipboard operation
xml2rfc copied to clipboard

Generate a more compact index

Open martinthomson opened this issue 1 year ago • 11 comments

The current method for constructing an index uses <xref> elements underneath, which generates an extremely verbose index if you choose to use that feature. Take this example (this link won't work forever, sorry, but here is an archive), which shows just how bad this can get.

A more compact version of the same index might uses symbols in place of the words.

martinthomson avatar Aug 17 '22 04:08 martinthomson

Assuming you don't plan to print it out, why is this a problem?

jrlevine avatar Aug 17 '22 14:08 jrlevine

On 2022-08-17, at 16:40, John L @.***> wrote:

Assuming you don't plan to print it out, why is this a problem?

Some of us actually look at indexes and click on things (did it just yesterday for the C++ standard). Doing this in a forest of noise is unnecessarily hard.

Grüße, Carsten

cabo avatar Aug 17 '22 14:08 cabo

Looks to me like the fix is to combine repeated items, e.g. Section 1, Paragraph 3; Section 2, Paragraph 1; Section 2, Paragraph 3; Section 2, Paragraph 3; Section 2, Paragraph 3; Section 2, Paragraph 6, Item 1; Section 2, Paragraph 6, Item 2; Section 2, Paragraph 6, Item 3; Section 2, Paragraph 6, Item 9; Section 2, Paragraph 6, Item 10; turns into [Section 1, Paragraph 3]; [Section 2, Paragraph 1, 3, 6.1, 6.2, 6.3, 6.9, 6.10]

jrlevine avatar Aug 17 '22 16:08 jrlevine

On 2022-08-17, at 18:21, John L @.***> wrote:

[Section 1, Paragraph 3]; [Section 2, Paragraph 1, 3, 6.1, 6.2, 6.3, 6.9, 6.10]

[§ 1: ¶ 3]; [§ 2: ¶ 1, 3, 6.1, 6.2, 6.3, 6.9, 6.10]

Now we are talking :-)

Grüße, Carsten

cabo avatar Aug 17 '22 16:08 cabo

[§ 1: ¶ 3]; [§ 2: ¶ 1, 3, 6.1, 6.2, 6.3, 6.9, 6.10]

I can give that a spin. Note that we have three levels of nesting here, which will make it a little more challenging to present, but a single layer of collapse might help.

martinthomson avatar Aug 18 '22 01:08 martinthomson

OK, so it turns out that Carsten's (or maybe it was John's) suggestion is still a good one, but not one that I'm likely to get around to. It's a little tricky to manage. Is there any reason that an optional feature like this would be undesirable?

martinthomson avatar Jan 16 '23 22:01 martinthomson

I took a look at implementing the merging idea, which is a good one. That is an entirely different part of the process.

My limited understanding is that the generation of links in the index occurs in the preptool. Basically, in step 1 the preptool populates an index with a bunch of <xref> elements, then the index is rendered using fairly normal <xref> rendering rules maybe with a few tweaks. This pull request only affects the rendering of those links into text or HTML. A separate change would be needed to change the content of those links. That might happen, but it can do so separately.

martinthomson avatar May 04 '23 02:05 martinthomson

FWIW; the index should not be part of the prepped document.

reschke avatar Dec 11 '23 16:12 reschke

FWIW; the index should not be part of the prepped document.

On the contrary, the point of prepping is to get a document ready to render and the index definitely belongs there. Same as the table of contents. We can have a meta-argument about what the scope of the preptool should be, but this is what it is now.

jrlevine avatar Dec 11 '23 16:12 jrlevine

the point of prepping is to get a document ready to render

Nope. That's how it's used by xml2rfc right now, but that has absolutely nothing to do what the preptool was designed for. Putting the Toc, the authors section and the index here is simply an abuse for how xml2rfc works internally.

reschke avatar Dec 11 '23 16:12 reschke

I agree with @reschke. The way that the preptool works currently leaks its internal business everywhere.

martinthomson avatar Dec 11 '23 22:12 martinthomson