3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-25 18:15:34 +00:00

Docs: Improve autoref

Fix `help $cell` type references, as well as actually implement the fallback to yoscrypt.
This commit is contained in:
Krystine Sherwin 2025-03-21 10:24:28 +13:00
parent 5d239204f2
commit e289e32e61
No known key found for this signature in database
2 changed files with 17 additions and 5 deletions

View file

@ -715,10 +715,18 @@ class CellDomain(CommandDomain):
def autoref(name, rawtext: str, text: str, lineno, inliner: Inliner,
options=None, content=None):
role = 'cell:ref' if text[0] == '$' else 'cmd:ref'
if text.startswith("help ") and text.count(' ') == 1:
_, cmd = text.split(' ', 1)
text = f'{text} <{cmd}>'
words = text.split(' ')
if len(words) == 2 and words[0] == "help":
IsLinkable = True
thing = words[1]
else:
IsLinkable = len(words) == 1 and words[0][0] != '-'
thing = words[0]
if IsLinkable:
role = 'cell:ref' if thing[0] == '$' else 'cmd:ref'
text = f'{text} <{thing}>'
else:
role = 'yoscrypt'
return inliner.interpreted(rawtext, text, role, lineno)
def setup(app: Sphinx):