Multiple anchors/ids for description list item (glossary pluralization)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple anchors/ids for description list item (glossary pluralization)

oddhack
I'm trying to reproduce the functionality of LaTeX glossary package \glspl{term}, which produces a link to the glossary for the specified term, but puts it in text as pluralized (e.g. "terms" would link to the glossary "term" entry). My first thought was

[[terms]]term:: A term

But while <<term>> and <<terms>> do both link to this, the former shows up with the rendered "[term]" style in HTML output. I can say <<term,term>> and avoid this ugliness, but that makes markup considerably longer to write. There doesn't seem to be a way to specify multiple anchors on a list item, so I can't say something like

[[term]]term[[terms]]:: A term

AFAICT.

Are there better / different options that allow interchangeable use of the singular and plural terms to link to the same glossary term? Writing a Ruby macro is off the table learning curve-wise.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

habamax

On 22.05.2020 17:33, oddhack [via Asciidoctor :: Discussion] wrote:

> I'm trying to reproduce the functionality of LaTeX glossary package
> \glspl{term}, which produces a link to the glossary for the specified
> term, but puts it in text as pluralized (e.g. "terms" would link to
> the glossary "term" entry). My first thought was
>
> [[terms]]term:: A term
>
> But while <<term>> and <<terms>> do both link to this, the former
> shows up with the rendered "[term]" style in HTML output. I can say
> <<term,term>> and avoid this ugliness, but that makes markup
> considerably longer to write. There doesn't seem to be a way to
> specify multiple anchors on a list item, so I can't say something like
>
I don't think <<term>> would link to [[terms]]. And actually that is why
it is rendered as [term] in your html.


>
> Are there better / different options that allow interchangeable use of
> the singular and plural terms to link to the same glossary term?
> Writing a Ruby macro is off the table learning curve-wise.
>

Why wouldn't you use [[term, terms]] and use <<term>> to show urls as
terms? And if you need to name it differently, use <<term, Longer
description of the url>> ?

Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

oddhack
habamax wrote
I don't think <<term>> would link to [[terms]]. And actually that is why
it is rendered as [term] in your html.
Interesting. I see different behavior between command-line client 2.0.10 and Asciidoctor.js Live Preview 2.5.0. The former does as you say but the latter does have both link to the glossary entry.

>
> Are there better / different options that allow interchangeable use of
> the singular and plural terms to link to the same glossary term?
> Writing a Ruby macro is off the table learning curve-wise.
>

Why wouldn't you use [[term, terms]] and use <<term>> to show urls as
terms?
Because it does entirely the wrong thing? If I say

<<term>>, <<terms>>

[[term,terms]]term:: A term

then the rendered result is

[term], term

of which the first link is broken, and the second is not pluralized.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

habamax

Why wouldn't you use [[term, terms]] and use <<term>> to show urls as
terms?
Because it does entirely the wrong thing? If I say

<<term>>, <<terms>>

[[term,terms]]term:: A term

then the rendered result is

[term], term

of which the first link is broken, and the second is not pluralized.


Well, that is how asciidoctor works I believe. You have defined one anchor named [[term]] and can not link to it with <<terms>> because there is no such anchor defined.

I don't think it is possible to do in a general way (there are a lot of languages you have to take into account). As for english you will have to extend asciidoctor with ruby to make it happen. I am not sure it is feasible, but you, of course can try.


I would stop at a single [[term]] or [[terms]] depending on frequency use in your text and use either <<term, terms>> or <<terms, term>> for the rest of urls.

On the other hand it should be possible to use multiple anchors on the same place as described in manual:https://asciidoctor.org/docs/user-manual/#multiple-anchors

But it looks like it is broken and there should be issue registerd on asciidoctor github.

== [[term]][[terms]] As in manual example

link to <<term>> and another one to <<terms>>

are rendered as [term] and [terms] which according to manual should not happen.

Even more funny it works differently with exported PDF -- rendered with the same issue but links to table of contents.



Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

oddhack
habamax wrote
On the other hand it should be possible to use multiple anchors on the
same place as described in
manual:https://asciidoctor.org/docs/user-manual/#multiple-anchors

But it looks like it is broken and there should be issue registerd on
asciidoctor github.
I believe multiple IDs are only supposed to work for sections, not for blocks (I am unsure if a description list item counts as a "block", but pretty sure it does not count as a "section").
Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

habamax
In reply to this post by habamax

> But it looks like it is broken and there should be issue registerd on
> asciidoctor github.
>
> == [[term]][[terms]] As in manual example
>
> link to <<term>> and another one to <<terms>>
>
> are rendered as [term] and [terms] which according to manual should
> not happen.
>
> Even more funny it works differently with exported PDF -- rendered
> with the same issue but links to table of contents.
>
>

Issue is created

https://github.com/asciidoctor/asciidoctor-pdf/issues/1702

Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

habamax
In reply to this post by oddhack


On 22.05.2020 18:18, oddhack [via Asciidoctor :: Discussion] wrote:
habamax wrote
On the other hand it should be possible to use multiple anchors on the
same place as described in
manual:https://asciidoctor.org/docs/user-manual/#multiple-anchors

But it looks like it is broken and there should be issue registerd on
asciidoctor github.
I believe multiple IDs are only supposed to work for sections, not for blocks (I am unsure if a description list item counts as a "block", but pretty sure it does not count as a "section").

I don't know for sure and manual do not state it explicitly, so let's wait till @mojavelinux comment on it.

But anyway it doesn't work for sections too, see my issue created.

Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

mojavelinux
Administrator
In reply to this post by oddhack
Currently, Asciidoctor supports exactly one anchor on a description list term. It must come at the beginning:

[[term]]name of term:: desc of term

<<<

see <<term>>

In this case, the linked text will be "name of term".

If you add any more anchors, it will not work.

-Dan

--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchors/ids for description list item (glossary pluralization)

mojavelinux
Administrator
In reply to this post by oddhack
I forgot to add that you can define alternate ref text at the location of the anchor:

[[term,alt text]]name of term:: desc of term

<<<

see <<term>>

Best Regards,

-Dan

--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux