Skip to content

Commit

Permalink
fix: Render xref in name element similar to everywhere else
Browse files Browse the repository at this point in the history
When `xref` is in `title`, if `xref` has a target to a `reference` use
square brackets (`[ <target text> ]`).
If the `xref` target is not a reference don't use brackets or parenthesis.

If `xref` element has text content:
For `reference` targets:
    `<text content> [<target>]`
For other targets:
    `<text content> (<target>)`
  • Loading branch information
kesara committed Sep 8, 2023
1 parent 57f0ce3 commit 7d36439
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion xml2rfc/writers/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -2847,8 +2847,16 @@ def render_xref(self, h, x):
if format == 'none':
reftext = content
hh = build.span(reftext, classes='xref cite')
elif target in self.refname_mapping and format != 'title':
if content:
hh = build.span(content, ' ', '[', reftext, ']', classes='xref cite')
else:
hh = build.span('[', reftext, ']', classes='xref cite')
else:
hh = build.span('[', reftext, ']', classes='xref cite')
if content:
hh = build.span(content, ' ', '(', reftext, ')', classes='xref cite')
else:
hh = build.span(reftext, classes='xref cite')
else:
srefclass = 'xref internal'
if not content and format != 'title':
Expand Down

0 comments on commit 7d36439

Please sign in to comment.