Inline markup in indexterms
Opened this issue · 1 comments
I see that you designed indexterms as attributes on an <a> element.
Consider the following indexterm examples:
- NMR spectrum, cis-[Co(NH3)4Cl2]+
- Complexity, O(n log n)
If terms like these cannot be captured in the body of a chemistry or computer science book, you are left with the following choices:
- include plain terms in the index (“NMR, cis-[Co(NH3)4Cl2]+”; “Complexity, O(n log n)”);
- reconstruct markup during index generation, using regex replacements or other transformation rules;
- include pseudo markup in the attributes that will be transformed to proper markup in the rendered index;
- create the index by hand.
I think neither is desirable. Instead, one should be able to designate rich text as a primary/secondary/tertiary index term. A way of doing so that plays nicely with the existing mechanism may be like that:
<a id="term1" data-type="indexterm" data-primary="NMR"/>
<a href="#term1" data-type="secondary-indexterm"><span style="font-style:italic">cis</span>-[Co(NH<sub>3</sub>)<sub>4</sub>Cl<sub>2</sub>]<sup>+</sup></a>
<a id="term2" data-type="primary-indexterm">CO<sub>2</sub> laser</a>
<a id="term3" data-type="indexterm" data-primary="Complexity"/>
<a href="#term3" data-type="secondary-indexterm" style="display:none"><math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mi>O</mi><mo></mo>
<mfenced open="(" close=")" separators=",">
<mrow>
<mi>n</mi>
<mo>log</mo>
<mi>n</mi>
</mrow>
</mfenced>
</mrow>
</math></a>
In the default CSS, you’d specify
a[data-type=primary-indexterm] { display: none }
a[data-type=secondary-indexterm] { display: none }
a[data-type=tertiary-indexterm] { display: none }
Of course the XSD and the XSL will become more complex, but from an author’s perspective, it’s ok since simple indexterms remain simple while complex indexterms become feasible.
A final remark on primary/secondary/tertiary: some people might argue that it is desirable to allow an arbitrary depth of index terms (as in TEI or in BITS). I don’t subscribe to that view because the index nesting depth that we have in DocBook or in LaTeX has proven sufficient.Yet I strongly oppose the notion that markup-free (InDesign-style) index terms are sufficient for STM content.
Hi @gimsieke,
Thanks for the great feedback and suggestions regarding the indexterm specs. Agree completely that it's a deficiency of the existing specs that you can't use rich markup for indexterm text, and that none of the workarounds you've posited are very good solutions.
I like your suggestions for extending the spec to support additional markup for indexterms as child nodes of the <a> term (although I'm not thrilled with the extra requirement of adding CSS to suppress their display), so I'm definitely going to look into implementing something along these lines when we do the next revision of the spec.
And I'm in agreement that primary/secondary/tertiary is sufficient for STM content :)
Thanks again for taking the time to write up all this feedback. Much appreciated!
Sanders