Make dfhack-tool tags link to tag descriptions

develop
lethosor 2022-08-06 17:26:33 -04:00
parent bb2ca0cc16
commit 12b3363b2c
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 8 additions and 1 deletions

@ -6,6 +6,7 @@
import docutils.nodes as nodes import docutils.nodes as nodes
# import docutils.parsers.rst.directives as rst_directives # import docutils.parsers.rst.directives as rst_directives
import sphinx import sphinx
import sphinx.addnodes as addnodes
import sphinx.directives import sphinx.directives
import dfhack.util import dfhack.util
@ -26,7 +27,13 @@ class DFHackToolDirective(sphinx.directives.ObjectDescription):
tag_nodes = [nodes.strong(text='Tags: ')] tag_nodes = [nodes.strong(text='Tags: ')]
for tag in self.options.get('tags', []): for tag in self.options.get('tags', []):
tag_nodes += [ tag_nodes += [
nodes.literal(tag, tag), addnodes.pending_xref(tag, nodes.inline(text=tag), **{
'reftype': 'ref',
'refdomain': 'std',
'reftarget': 'tag/' + tag,
'refexplicit': False,
'refwarn': True,
}),
nodes.inline(text=' | '), nodes.inline(text=' | '),
] ]
tag_nodes.pop() tag_nodes.pop()