Fix tool name auto-detection for scripts in subfolders

develop
lethosor 2022-09-15 23:03:34 -04:00
parent 50772b3138
commit c1154085cf
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 5 additions and 1 deletions

@ -114,7 +114,11 @@ class DFHackToolDirectiveBase(sphinx.directives.ObjectDescription):
if self.arguments:
return self.arguments[0]
else:
return self.env.docname.split('/')[-1]
parts = self.env.docname.split('/')
if 'tools' in parts:
return '/'.join(parts[parts.index('tools') + 1:])
else:
return parts[-1]
@staticmethod
def wrap_box(*children: List[nodes.Node]) -> nodes.Admonition: