|
|
@ -12,13 +12,16 @@ import dfhack.util
|
|
|
|
|
|
|
|
|
|
|
|
class DFHackToolDirective(sphinx.directives.ObjectDescription):
|
|
|
|
class DFHackToolDirective(sphinx.directives.ObjectDescription):
|
|
|
|
has_content = False
|
|
|
|
has_content = False
|
|
|
|
required_arguments = 1
|
|
|
|
required_arguments = 0
|
|
|
|
option_spec = {
|
|
|
|
option_spec = {
|
|
|
|
'tags': dfhack.util.directive_arg_str_list,
|
|
|
|
'tags': dfhack.util.directive_arg_str_list,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
def run(self):
|
|
|
|
tool_name = self.get_signatures()[0]
|
|
|
|
if self.arguments:
|
|
|
|
|
|
|
|
tool_name = self.arguments[0]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
tool_name = self.env.docname.split('/')[-1]
|
|
|
|
|
|
|
|
|
|
|
|
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', []):
|
|
|
@ -33,11 +36,6 @@ class DFHackToolDirective(sphinx.directives.ObjectDescription):
|
|
|
|
nodes.paragraph('', '', *tag_nodes),
|
|
|
|
nodes.paragraph('', '', *tag_nodes),
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# simpler but always renders as "inline code" (and less customizable)
|
|
|
|
|
|
|
|
# def handle_signature(self, sig, signode):
|
|
|
|
|
|
|
|
# signode += addnodes.desc_name(text=sig)
|
|
|
|
|
|
|
|
# return sig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def register(app):
|
|
|
|
def register(app):
|
|
|
|
app.add_directive('dfhack-tool', DFHackToolDirective)
|
|
|
|
app.add_directive('dfhack-tool', DFHackToolDirective)
|
|
|
|