-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need documentation on how to reference Glossary entries using alternate terms #13119
Comments
… with alternate word forms.
This is a lengthy post and I'm wondering why not take advantage of the .. glossary::
understandability
... omitted for sake of brevity... I would then reference it in the docs as:
This would give you a single entry in the general index: |
Brilliant! That works beautifully! And that is what I was missing! So my PR will change to adding a paragraph describing the above to the |
… with alternate word forms.
Is your feature request related to a problem? Please describe.
I was originally going to ask for a feature: to add glossary-entry anchors into the namespace used by the
:ref:
directive so that glossary entries could be linked to in documentation that uses different terms (e.g. different forms of the same word). In the process of describing it and doing tests, I THOUGHT I discovered a solution that would work for me, but as it turns out, it doesn't work as intended. I will leave the below in place since it describes the use case very well, but am revising this as a feature request:That since a term in a glossary creates the HTML anchor
<a id="term-actual_term">
, that this identifier be additionally placed in the same namespace that is used by the:ref:
role so that when a term needs to be linked to from another form of the same word (e.g. "understandability" vs "understandable", calling from my example below) that a:ref:
role can be used to link to it like this:An alternate, but also workable, solution would be to make the "explicit link targets" within a glossary list (as illustrated below) actually add the anchor
<a id="link_label">
into the HTML output as it normally does for "explicit link targets". It is currently not doing that when the "explicit link target" is in a glossary list.Kind regards,
Vic
Here is my real situation and it is a valid and frequently-encountered use case for many large technical documents I maintain — all of which have glossaries. Taking an example from one of these documents (about my company's Coding Standards), I have an existing glossary-like set-up using the standard facilities of the
:ref:
role. Here is the entry I will use for illustration:Now that all works for a glossary using the
.. glossary::
directive as long as I use exactly that term to link to it using the:term:
role. However, in my actual document, I link to it using many different terms from many different.rst
files. The terms used are:Using the
:ref:
role, of course I can handle these cases like this (taking "understand" as an example):or I can load up the entry with "explicit link targets" using alternate spellings like this so the generated HTML gets an "anchor" (
<a id="alternate term">
) for each one:and then reference it like this:
However, until I found the solution below, I had found no way of handling this use case with the
.. glossary::
directive.I note that in the HTML output that the glossary entries create an anchor like this:
<a id="term-understandability">
, so I triedbut sadly, that doesn't work either.
I also tried inserting "explicit link targets" into the glossary like this (so I could continue to reference it using
:ref:'understand'
):But then the
.. _understand:
link target terminates the glossary definition list, so everything that comes after it is no longer in the glossary.Solution
An obscure solution is to indent the "explicit link target" like this (using the same syntax [indenting] as adding "link targets" to items in a list):
This does work, allowing me to link to it like this:
But it took me several hours of testing and experimenting (and finally remembering the way to add an "explicit link target" into an unordered list) before I found this solution. Unfortunately, it is not yet documented under the
.. glossary::
directive, but should be, since it is such a common use case.Note:
I rejected the solution of doing it with just
reStructuredText
link targets like this because it would create a maintenance nightmare due to the number of places (every.rst
file) where this would have to be done:It would work but would just be a very bad idea for future maintenance, and would have to be done everywhere I link to that term in my glossary. Eeek!
Describe the solution you'd like
The above solution clearly documented under the
.. glossary::
directive so that other writers like me can successfully deal with the above frequently-encountered use case.Describe alternatives you've considered
See above.
Additional context
All given above.
I will be submitting a PR to handle this shortly.
The text was updated successfully, but these errors were encountered: