Skip to content

Commit

Permalink
Merge pull request #947 from riscv/xml-links
Browse files Browse the repository at this point in the history
Don't link to registers that we don't describe.
  • Loading branch information
wmat authored Jan 9, 2024
2 parents e2ba36d + 231cb43 commit 4c6f6e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ def write_adoc_definitions( fd, registers ):
regid = r.short or r.label
if r.define:
macroName = toAdocIdentifier( registers.prefix, regid )
fd.write( f":{macroName}: <<{macroName},{r.short or r.label}>>\n" )
if r.fields or r.description:
fd.write( f":{macroName}: <<{macroName},{r.short or r.label}>>\n" )
else:
fd.write( f":{macroName}: {r.short or r.label}\n" )
for f in r.fields:
if f.define:
macroName = toAdocIdentifier( regid, f.name )
Expand Down Expand Up @@ -1008,7 +1011,10 @@ def write_adoc_index( fd, registers ):
name = "%s ({%s})" % (r.name, identifier)
else:
name = "{%s}" % identifier
link = f"xref:{identifier}[]"
if r.fields or r.description:
link = f"xref:{identifier}[]"
else:
link = ""
if r.sdesc:
fd.write("|%s |%s |%s| %s\n" % ( r.address, name, r.sdesc, link ))
else:
Expand Down

0 comments on commit 4c6f6e0

Please sign in to comment.