Thank you for pointing me at :ref:`genindex` and :ref:`modindex`!
I was able to use that to figure out how to add similar ref labels for
one's own generated pages. It's actually not that hard!
- You have to create an extension, or have one you can stick this code into
(I have one called 'my_local.py' that I use for small local specific
extensions for my own docs).
- You create your own child class of StandardDomain, give it the class vars
'name' of 'std' and 'label' of 'Default'.
- Overload the 'initial_data' class var, to copy the StandardDomain data,
and add your own specific ref labels for your own generated indices (here,
I am adding ref labels that will point to generated indexes for my 'http
domain' that I use for documenting web-services APIs, based on the
httpdomain.py sphinx contrib domain).
- Use app.override_domain to explicitly overload the out-of-the-box
StandardDomain, with your child class.
- Enjoy.
from sphinx.domains.std import StandardDomain
from sphinx.locale import l_
class MyStandardDomain(StandardDomain):
name = 'std'
label = 'Default'
# overload initial data for custom Standard Domain
initial_data = {
'progoptions': {}, # (program, name) -> docname, labelid
'objects': {}, # (type, name) -> docname, labelid
'citations': {}, # name -> docname, labelid
'labels': { # labelname -> docname, labelid, sectionname
'genindex': ('genindex', '', l_('Index')),
'modindex': ('py-modindex', '', l_('Module Index')),
'search': ('search', '', l_('Search Page')),
'routesindex': ('http-routingtable', '', l_('Routing Table')),
'scopesindex': ('http-scopestable', '', l_('Scopes Table'))
},
'anonlabels': { # labelname -> docname, labelid
'genindex': ('genindex', ''),
'modindex': ('py-modindex', ''),
'search': ('search', ''),
'routesindex': ('http-routingtable', ''),
'scopesindex': ('http-scopestable', '')
},
}
def setup(app):
# overload existing standard domain
app.override_domain(D2LStandardDomain)
On Tuesday, 14 February 2017 10:37:52 UTC-5, Komiya Takeshi wrote:
>
> Hi,
>
> You can refer the general index and python-module index using :ref: role
> (:ref:`genindex` and :ref:`modindex`).
> But we can not refer other index pages using the role.
> AFAIK there are no way to make links to them.
>
> BTW the index pages are not a "document". so you can use :doc: role to
> refer them.
>
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.