Reference to :label:`ABC-1234` testing.
Hello Ed,
using the sphobjinv converter....
ah, interesting, I'll take a look.
Have you seen https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#showing-all-links-of-an-intersphinx-mapping-file?
You could run that for your file and, let's say, https://docs.python.org/3/objects.inv and then compare the two.
--
Martin Bless
Reference to This is an example JIRA ticket reference..
Hi Ed,
① thanks for pointing me to that `sphobjinv` tool. Very helpful!
② I used it to look into one of our `objects.inv` files. A drastically shortened version looks like this:
# Sphinx inventory version 2
# Project: TYPO3 Explained
# Version: 11.0 (development)
# The remainder of this file is compressed using zlib.
About std:doc -1 About.html About This Manual
ApiOverview/Index std:doc -1 ApiOverview/Index.html API
Overview
be-user std:label -1
ApiOverview/BackendUserObject/Index.html#$ Backend User Object
be-user-admin std:label -1
ApiOverview/BackendUserObject/Index.html#$ Is “admin”?
Then, in reStructuredText, we can write
:doc:`About`
to create a link to the file https://.../About.html
and you can write
:ref:`be-user`
to create a link to the bookmark
https://.../ApiOverview/BackendUserObject/Index.html#be-user
I know this just from experience and I'm still looking myself for documentation why 'ref' is used for 'std:label' and 'doc' for 'std:doc'.
BTW, these are the real links:
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/About.html#about
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/BackendUserObject/Index.html#be-user
③ FYI: About six years ago I created a Sphinx-extension that we are still using. I has a single directive:
.. ref-targets-list::
that will produce the content you see here: https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/Targets.html
Editors can consult that page to see what crossreferencing targets are available.
See
https://github.com/TYPO3-Documentation/sphinxcontrib.t3targets and
https://pypi.org/project/t3targets/
--
Martin Bless
Hello Ed,
now, looking again at your post:
jira-objects.txt (compressed to jira-objects.inv)# Sphinx inventory version 2# Project: JIRA# Version:# The remainder of this file is compressed using zlib.ABC-1234 std:label 1 #$ This is an example JIRA ticket reference.
conf.py includes this option:intersphinx_mapping = {'jira': ('https://example.atlassian.net/browse', 'jira-objects.inv')}
Within a page I then tried a number of ways to reference ABC-1234 with no luck.
Example 1:Reference to :ref:`ABC-1234`.
You almost got it right. What you have to write to create the link:
① :ref:`...` <- this is the correct textrole.
② :ref:`ABC-123` <- The label is correct. Would work if the
label was defined in the same project
③ :ref:`jira:ABC-123` <- This will really work. Prefix the
label with 'jira:', because you chose 'jira' in the Intersphinx
mapping
Line ③ will have 'This is an example JIRA tecket reference" as linktext.
④ :ref:`Feature 123 <jira:ABC-123>` will work and have linktext 'Feature 123'
Note:
- case of the label doesn't matter
- case of the prefix ('jira') may matter - I don't know by heart
- Don't forget one or more blanks before the '<' in ④.
Let me know if that works!
--
Martin Bless