use a label instead of a custom role

since I can't seem to figure out how to inject a link to a label via the
role processing code
develop
myk002 2022-07-22 15:16:57 -07:00
parent 6752025848
commit e8ffa55dfe
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
26 changed files with 43 additions and 54 deletions

@ -82,18 +82,7 @@ def dfhack_keybind_role_func(role, rawtext, text, lineno, inliner,
return [newnode], [] return [newnode], []
# pylint:disable=unused-argument,dangerous-default-value,too-many-arguments
def dfhack_tag_role_func(role, rawtext, text, lineno, inliner,
options={}, content=[]):
"""Custom role parser for DFHack tags."""
roles.set_classes(options)
# TODO: link to generated tag index page
newnode = nodes.inline(text, text)
return [newnode], []
roles.register_canonical_role('dfhack-keybind', dfhack_keybind_role_func) roles.register_canonical_role('dfhack-keybind', dfhack_keybind_role_func)
roles.register_canonical_role('dfhack-tag', dfhack_tag_role_func)
# -- Autodoc for DFhack plugins and scripts ------------------------------- # -- Autodoc for DFhack plugins and scripts -------------------------------
@ -129,7 +118,7 @@ DOC_ALL_DIRS = doc_all_dirs()
def get_tags(): def get_tags():
tags = [] tags = []
tag_re = re.compile(r'- :dfhack-tag:`([^`]+)`: (.*)') tag_re = re.compile(r'- `tag/([^`]+)`: (.*)')
with open('docs/Tags.rst') as f: with open('docs/Tags.rst') as f:
lines = f.readlines() lines = f.readlines()
for line in lines: for line in lines:

@ -4,8 +4,8 @@ Tool categories
=============== ===============
DFHack tools are grouped to make them easier to find. Note that a tool can DFHack tools are grouped to make them easier to find. Note that a tool can
belong to more than one category. If you'd like to see the full list of tools, belong to more than one category. If you'd like to see the full list of tools
please refer to the `index <genindex>`. in one flat list, please refer to the `index <genindex>`.
.. contents:: Contents .. contents:: Contents
:local: :local:

@ -185,7 +185,7 @@ where ``*`` can be any string, including the empty string.
A world being loaded can mean a fortress, an adventurer, or legends mode. A world being loaded can mean a fortress, an adventurer, or legends mode.
These files are best used for non-persistent commands, such as setting These files are best used for non-persistent commands, such as setting
a :dfhack-tag:`fix` script to run on `repeat`. a `tag/fix` script to run on `repeat`.
.. _onMapLoad.init: .. _onMapLoad.init:

@ -63,7 +63,7 @@ are not built by default, but can be built by setting the ``BUILD_DEVEL``
Scripts Scripts
~~~~~~~ ~~~~~~~
Several :dfhack-tag:`development tools <dev>` can be useful for memory research. Several `development tools <tag/dev>` can be useful for memory research.
These include (but are not limited to): These include (but are not limited to):
- `devel/dump-offsets` - `devel/dump-offsets`

@ -1,19 +1,19 @@
:orphan: :orphan:
- :dfhack-tag:`adventure`: Tools that are useful while in adventure mode - `tag/adventure`: Tools that are useful while in adventure mode
- :dfhack-tag:`fort`: Tools that are useful while in fort mode - `tag/fort`: Tools that are useful while in fort mode
- :dfhack-tag:`legends`: Tools that are useful while in legends mode - `tag/legends`: Tools that are useful while in legends mode
- :dfhack-tag:`items`: Tools that create or modify in-game items - `tag/items`: Tools that create or modify in-game items
- :dfhack-tag:`units`: Tools that create or modify units - `tag/units`: Tools that create or modify units
- :dfhack-tag:`jobs`: Tools that create or modify jobs - `tag/jobs`: Tools that create or modify jobs
- :dfhack-tag:`labors`: Tools that deal with labor assignment - `tag/labors`: Tools that deal with labor assignment
- :dfhack-tag:`auto`: Tools that automatically manage some aspect of your fortress - `tag/auto`: Tools that automatically manage some aspect of your fortress
- :dfhack-tag:`map`: Map modification - `tag/map`: Map modification
- :dfhack-tag:`system`: Tools related to working with DFHack commands or the core DFHack library - `tag/system`: Tools related to working with DFHack commands or the core DFHack library
- :dfhack-tag:`productivity`: Tools that help you do things that you could do manually, but using the tool is better and faster - `tag/productivity`: Tools that help you do things that you could do manually, but using the tool is better and faster
- :dfhack-tag:`animals`: Tools that help you manage animals - `tag/animals`: Tools that help you manage animals
- :dfhack-tag:`fix`: Tools that fix specific bugs - `tag/fix`: Tools that fix specific bugs
- :dfhack-tag:`inspection`: Tools that let you inspect game data - `tag/inspection`: Tools that let you inspect game data
- :dfhack-tag:`buildings`: Tools that help you work wtih placing or configuring buildings and furniture - `tag/buildings`: Tools that help you work wtih placing or configuring buildings and furniture
- :dfhack-tag:`quickfort`: Tools that are involved in creating and playing back blueprints - `tag/quickfort`: Tools that are involved in creating and playing back blueprints
- :dfhack-tag:`dev`: Tools useful for develpers and modders - `tag/dev`: Tools useful for develpers and modders

@ -1,7 +1,7 @@
alias alias
===== =====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`alias` :dfhack-keybind:`alias`
:index:`Configure helper aliases for other DFHack commands. :index:`Configure helper aliases for other DFHack commands.

@ -1,7 +1,7 @@
cls cls
=== ===
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`cls` :dfhack-keybind:`cls`
:index:`Clear the terminal screen. <cls; Clear the terminal screen.>` Can also :index:`Clear the terminal screen. <cls; Clear the terminal screen.>` Can also

@ -1,7 +1,7 @@
devel/dump-rpc devel/dump-rpc
============== ==============
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`devel/dump-rpc` :dfhack-keybind:`devel/dump-rpc`
:index:`Write RPC endpoint information to the specified file. :index:`Write RPC endpoint information to the specified file.

@ -1,7 +1,7 @@
die die
=== ===
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`die` :dfhack-keybind:`die`
:index:`Instantly exit DF without saving. :index:`Instantly exit DF without saving.

@ -1,7 +1,7 @@
disable disable
======= =======
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`disable` :dfhack-keybind:`disable`
:index:`Deactivate a DFHack tool that has some persistent effect. :index:`Deactivate a DFHack tool that has some persistent effect.

@ -1,7 +1,7 @@
enable enable
====== ======
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`enable` :dfhack-keybind:`enable`
:index:`Activate a DFHack tool that has some persistent effect. :index:`Activate a DFHack tool that has some persistent effect.

@ -1,7 +1,7 @@
fpause fpause
====== ======
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`fpause` :dfhack-keybind:`fpause`
:index:`Forces DF to pause. <fpause; Forces DF to pause.>` This is useful when :index:`Forces DF to pause. <fpause; Forces DF to pause.>` This is useful when

@ -1,7 +1,7 @@
help help
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`help` :dfhack-keybind:`help`
:index:`Display help about a command or plugin. :index:`Display help about a command or plugin.

@ -1,7 +1,7 @@
hide hide
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`hide` :dfhack-keybind:`hide`
:index:`Hide the DFHack terminal window. :index:`Hide the DFHack terminal window.

@ -1,7 +1,7 @@
keybinding keybinding
========== ==========
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`keybinding` :dfhack-keybind:`keybinding`
:index:`Create hotkeys that will run DFHack commands. :index:`Create hotkeys that will run DFHack commands.

@ -1,7 +1,7 @@
kill-lua kill-lua
======== ========
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`kill-lua` :dfhack-keybind:`kill-lua`
:index:`Gracefully stops any currently-running Lua scripts. :index:`Gracefully stops any currently-running Lua scripts.

@ -1,7 +1,7 @@
load load
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`load` :dfhack-keybind:`load`
:index:`Load and register a plugin library. :index:`Load and register a plugin library.

@ -1,7 +1,7 @@
ls ls
== ==
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`ls` :dfhack-keybind:`ls`
:index:`List available DFHack commands. <ls; List available DFHack commands.>` :index:`List available DFHack commands. <ls; List available DFHack commands.>`

@ -1,7 +1,7 @@
plug plug
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`plug` :dfhack-keybind:`plug`
:index:`List available plugins and whether they are enabled. :index:`List available plugins and whether they are enabled.

@ -1,7 +1,7 @@
reload reload
====== ======
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`reload` :dfhack-keybind:`reload`
:index:`Reload a loaded plugin. <reload; Reload a loaded plugin.>` Developers :index:`Reload a loaded plugin. <reload; Reload a loaded plugin.>` Developers

@ -1,7 +1,7 @@
sc-script sc-script
========= =========
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`sc-script` :dfhack-keybind:`sc-script`
:index:`Run commands when game state changes occur. :index:`Run commands when game state changes occur.

@ -1,7 +1,7 @@
script script
====== ======
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`script` :dfhack-keybind:`script`
:index:`Execute a batch file of DFHack commands. :index:`Execute a batch file of DFHack commands.

@ -1,7 +1,7 @@
show show
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`show` :dfhack-keybind:`show`
:index:`Unhides the DFHack terminal window. :index:`Unhides the DFHack terminal window.

@ -1,7 +1,7 @@
tags tags
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`tags` :dfhack-keybind:`tags`
:index:`List the strings that DFHack tools can be tagged with. :index:`List the strings that DFHack tools can be tagged with.

@ -1,7 +1,7 @@
type type
==== ====
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`type` :dfhack-keybind:`type`
:index:`Describe how a command is implemented. :index:`Describe how a command is implemented.

@ -1,7 +1,7 @@
unload unload
====== ======
Tags: :dfhack-tag:`system` Tags: `tag/system`
:dfhack-keybind:`unload` :dfhack-keybind:`unload`
:index:`Unload a plugin from memory. <unload; Unload a plugin from memory.>` :index:`Unload a plugin from memory. <unload; Unload a plugin from memory.>`