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

Ben Pfaff blp at ovn.org
Fri Nov 9 05:39:54 UTC 2018


Without this change, the fonts are wrong if a title contains formatting
like <code> or <var>.

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

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')
-- 
2.16.1



More information about the dev mailing list