Skip to content

Commit

Permalink
nroff: Fix fonts for h2, h3, h4.
Browse files Browse the repository at this point in the history
Without this change, the fonts are wrong if a title contains formatting
like <code> or <var>.

Acked-by: Mark Michelson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Jan 10, 2019
1 parent 63187cf commit a31c38a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/build/nroff.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ def block_xml_to_nroff(nodes, para='.PP'):
if s != "":
if not s.endswith("\n"):
s += "\n"
nroffTag = {'h1': 'SH',
'h2': 'SS',
'h3': 'ST',
'h4': 'SU'}[node.tagName]
nroffTag, font = {'h1': ('SH', r'\fR'),
'h2': ('SS', r'\fB'),
'h3': ('ST', r'\fI'),
'h4': ('SU', r'\fI')}[node.tagName]
to_upper = node.tagName == 'h1'
s += ".%s \"" % nroffTag
for child_node in node.childNodes:
s += inline_xml_to_nroff(child_node, r'\fR', to_upper)
s += inline_xml_to_nroff(child_node, font, to_upper)
s += "\"\n"
elif node.tagName == 'pre':
fixed = node.getAttribute('fixed')
Expand Down

0 comments on commit a31c38a

Please sign in to comment.