[PATCH 2 of 6] minimal reStructuredText parser

Martin Geisler mg at lazybytes.net
Thu Jul 16 04:21:00 CDT 2009

Matt Mackall <mpm at selenic.com> writes:

> On Fri, 2009-07-10 at 13:54 +0200, Martin Geisler wrote:
>> # HG changeset patch
>> # User Martin Geisler <mg at lazybytes.net>
>> # Date 1247223358 -7200
>> # Node ID 860b4d1f8341f5042ccbe51e2a83d57127c7df71
>> # Parent  5bb490a0b3ac97ad85f1848d72edd20757782904
>> minimal reStructuredText parser
> A while back, we talked about eventually being able to mark some
> portions (certain paragraphs and examples) in command help as
> 'verbose', can you see any way to easily accomodate that in this
> scheme?

I think so. Docutils has a generic container directive we can use:

  bla bla normal help

  .. container:: verbose

     A verbose paragraph.

     - bullet list
     - in the verbose block

     Another verbose paragraph.

  More normal help.

This is parsed right out of the box by the rst2html tool and results in
a <div class="verbose container"> being added around the verbose part in
the HTML. If we don't style this, it will look just like the rest of the

The rst2man tool currently halts when encountering a container
directive. But I've sent a patch upstream which makes it a no-op:


I hope he'll apply it -- he's already taken two other patches. When the
upstream rst2man is fixed, I'll talk to the Debian maintainer about
making a new snapshot.

On other systems people can use rst2man from a SVN checkout. That's how
I'm testing here at the university.

The minirst parser must be extended to recognized blocks that start
directives. This is very similar to how we currently flag literal blocks
and shouldn't be a problem.

> We'll also want to eventually hyperlink between various commands and
> help topics in HTML output.
> Otherwise patches 2-6 seem pretty reasonable.

Thanks. I will resend the updated series tonight when I get home and
then we can look at implementing the verbose-stuff after that.

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.

More information about the Mercurial-devel mailing list