diff options
| author | Ihar Hrachyshka <ihrachys@redhat.com> | 2020-02-13 12:27:27 -0500 |
|---|---|---|
| committer | Ben Pfaff <blp@ovn.org> | 2020-02-13 11:07:11 -0800 |
| commit | 3865b07409c007d5d272aea30eb0718cfbf068ee (patch) | |
| tree | e33c5edd76ee6f65c1b2104ac8a23fa18bafdfb3 /python/build | |
| parent | c72401297078a305c85f2c78a3640ce84260bfae (diff) | |
| download | openvswitch-3865b07409c007d5d272aea30eb0718cfbf068ee.tar.gz | |
docs: handle multi line headers for nroff
Before the fix, headers split into multiple lines were producing bogus
quote characters in nroff output and failed to indent headers properly.
Specifically, it fixes a header and its indentation in
ovn-architecture(7).
Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'python/build')
| -rw-r--r-- | python/build/nroff.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/python/build/nroff.py b/python/build/nroff.py index a94907757..09795ab52 100644 --- a/python/build/nroff.py +++ b/python/build/nroff.py @@ -290,6 +290,11 @@ fillval = .2 \\}""" +def flatten_header(s): + s = s.strip() + return re.sub(r'\s+', ' ', s) + + def block_xml_to_nroff(nodes, para='.PP'): HEADER_TAGS = ('h1', 'h2', 'h3', 'h4') s = '' @@ -373,7 +378,9 @@ def block_xml_to_nroff(nodes, para='.PP'): to_upper = node.tagName == 'h1' s += ".%s \"" % nroffTag for child_node in node.childNodes: - s += inline_xml_to_nroff(child_node, font, to_upper) + s += flatten_header( + inline_xml_to_nroff(child_node, font, to_upper) + ) s += "\"\n" elif node.tagName == 'pre': fixed = node.getAttribute('fixed') |
