Message ID | 20170105234822.16089-1-joe@ovn.org |
---|---|
State | Superseded |
Headers | show |
On Thu, Jan 05, 2017 at 03:48:22PM -0800, Joe Stringer wrote: > When XML is used for writing manpages, the nroff python utility indents > the <dd> tags an extra level which is unnecessary and makes the > formatting inconsistent between manpages written directly in nroff vs > manpages written in XML and converted to nroff. Fix the indentation by > removing the extraneous .RS / .RE tags added to generated nroff. > > Signed-off-by: Joe Stringer <joe@ovn.org> I've found that there are landmines in this area. Did you look around at a few manpages to make sure that this doesn't cause funny behavior in some cases, in situations like multiple paragraphs in <dd>s, or <dl>s nested in <ul>s or vice versa, etc.? If the real solution is just to delete two lines then I'm all for it.
On 5 January 2017 at 17:08, Ben Pfaff <blp@ovn.org> wrote: > On Thu, Jan 05, 2017 at 03:48:22PM -0800, Joe Stringer wrote: >> When XML is used for writing manpages, the nroff python utility indents >> the <dd> tags an extra level which is unnecessary and makes the >> formatting inconsistent between manpages written directly in nroff vs >> manpages written in XML and converted to nroff. Fix the indentation by >> removing the extraneous .RS / .RE tags added to generated nroff. >> >> Signed-off-by: Joe Stringer <joe@ovn.org> > > I've found that there are landmines in this area. Did you look around > at a few manpages to make sure that this doesn't cause funny behavior in > some cases, in situations like multiple paragraphs in <dd>s, or <dl>s > nested in <ul>s or vice versa, etc.? Looks like it does cause trouble with these. What I was trying to achieve, was that if the <dl> is directly nested under a toplevel header (that is, 'h1'), it should only indent one level rather than two. You're right, this version breaks a bunch of other cases; let me revise to make it only take effect in this case I'd like to fix.
diff --git a/python/build/nroff.py b/python/build/nroff.py index aed60ebbd592..cdeef6fb1904 100644 --- a/python/build/nroff.py +++ b/python/build/nroff.py @@ -250,7 +250,6 @@ def block_xml_to_nroff(nodes, para='.PP'): elif node.tagName == 'dl': if s != "": s += "\n" - s += ".RS\n" prev = "dd" for li_node in node.childNodes: if (li_node.nodeType == node.ELEMENT_NODE @@ -272,7 +271,6 @@ def block_xml_to_nroff(nodes, para='.PP'): raise error.Error("<dl> element may only have " "<dt> and <dd> children") s += block_xml_to_nroff(li_node.childNodes, ".IP") - s += ".RE\n" elif node.tagName == 'p': if s != "": if not s.endswith("\n"):
When XML is used for writing manpages, the nroff python utility indents the <dd> tags an extra level which is unnecessary and makes the formatting inconsistent between manpages written directly in nroff vs manpages written in XML and converted to nroff. Fix the indentation by removing the extraneous .RS / .RE tags added to generated nroff. Signed-off-by: Joe Stringer <joe@ovn.org> --- python/build/nroff.py | 2 -- 1 file changed, 2 deletions(-)