[ovs-dev] [PATCH 1/3] nroff: Support inline XML inside <pre> blocks.
Justin Pettit
jpettit at nicira.com
Mon Sep 21 23:04:52 UTC 2015
> 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 ">".
> 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.
Acked-by: Justin Pettit <jpettit at nicira.com>
--Justin
More information about the dev
mailing list