[ovs-dev] [PATCH 1/3] nroff: Support inline XML inside <pre> blocks.
Ben Pfaff
blp at nicira.com
Tue Sep 29 23:56:36 UTC 2015
On Mon, Sep 21, 2015 at 04:04:52PM -0700, Justin Pettit wrote:
>
> > On Sep 17, 2015, at 10:11 AM, Ben Pfaff <blp at nicira.com> wrote:
> >
> > This is useful so that one can write, e.g.
> >
> > <p>The following shows how to add 1 to variable <var>x</var>:</p>
> > <pre>
> > <var>x</var> = <var>x</var + 1;
>
> I think you're example could use a closing ">".
Thanks, fixed.
> > def pre_to_nroff(nodes, para, font):
> > - s = para + '\n.nf\n'
> > + # This puts 'font' at the beginning of each line so that leading and
> > + # trailing whitespace stripping later doesn't removed leading spaces
> > + # from preformatted text.
> > + s = para + '\n.nf\n' + font
> > for node in nodes:
> > - if node.nodeType == node.TEXT_NODE:
> > - for line in node.data.split('\n'):
> > - s += escape_nroff_literal(line, font) + '\n.br\n'
> > - elif node.nodeType != node.COMMENT_NODE:
> > - fatal("<pre> element may only have text children")
> > - s += '.fi\n'
> > + s += inline_xml_to_nroff(node, font, False, '\n.br\n' + font)
> > + s += '\n.fi\n'
>
> I'm by no means an expert on this code, but does this still handle
> comments properly? inline_xml_to_nroff() looks like it would complain
> about a comment node. In any case, superficially, it seems different
> than the previous behavior.
That's true. I changed inline_xml_to_nroff() to return '' for a comment
node.
> Acked-by: Justin Pettit <jpettit at nicira.com>
Thanks, I applied this to master.
More information about the dev
mailing list