[ovs-dev,2/3] nroff: Fix fonts for h2, h3, h4.

Message ID 20181109053955.28951-2-blp@ovn.org
State New
Headers show
Series
  • [ovs-dev,1/3] nroff: Increase width for .IP used for ordered lists.
Related show

Commit Message

Ben Pfaff Nov. 9, 2018, 5:39 a.m.
Without this change, the fonts are wrong if a title contains formatting
like <code> or <var>.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 python/build/nroff.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch

diff --git a/python/build/nroff.py b/python/build/nroff.py
index 17ff69bfe47a..78e4eae6aee4 100644
--- a/python/build/nroff.py
+++ b/python/build/nroff.py
@@ -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')