Commit Graph

70 Commits

Author SHA1 Message Date
Martin Geisler
9abe6f2e23 minirst: report pruned container types 2010-02-13 18:11:08 +01:00
Martin Geisler
5d09b1af66 minirst: support containers
Text can be grouped into generic containers in reStructuredText:

  .. container:: foo

     This is text inside a "foo" container.

     .. container:: bar

        This is nested inside two containers.

The minirst parser now recognizes these containers. The containers are
either pruned completely from the output (included all nested blocks)
or they are simply un-indented. So if 'foo' and 'bar' containers are
kept, the above example will result in:

     This is text inside a "foo" container.

     This is nested inside two containers.

If only 'foo' containers are kept, we get:

     This is text inside a "foo" container.

No output is made if only 'bar' containers are kept.

This feature will come in handy for implementing different levels of
help output (e.g., verbose and debug level help texts).
2009-10-04 22:03:41 +02:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Martin Geisler
cfb7949d48 minirst: update module docstring 2009-11-07 03:22:03 +01:00
Martin Geisler
4c7564177a minirst: support enumerated lists 2009-11-07 03:14:56 +01:00
Martin Geisler
04f9650185 minirst: prepare for general types of bullet lists
The old code worked for '-' bullets only, but we can easily support
variable width bullets.
2009-11-07 03:04:46 +01:00
Martin Geisler
182015cfeb minirst: combine list parsing in one function
Bullet, option, field, and definition lists were parsed very similar
code. They are now parsed by a single function (splitparagraphs).

Some logic from the old parsing functions has been moved down to
formatblock. This simplifies the parsing while putting the logic where
it's really needed.
2009-11-06 00:30:35 +01:00
Martin Geisler
25e020bb8c minirst: remove unnecessary "elif:" statements 2009-11-05 21:30:50 +01:00
Martin Geisler
fb05a0948c minirst: convert `foo` into "foo" upon display
This lets us markup many more occurances of inline literals since they
no longer look strange in the terminal output.
2009-10-20 22:16:27 +02:00
Martin Geisler
8b8fb723b7 help: un-indent help topics
The help topics are reused in the HTML documentation, and there it
looks odd that whole sections are indented. We now only indent it for
output on the terminal.
2009-10-04 12:18:43 +02:00
Martin Geisler
298efc8d54 util, minirst: do not crash with COLUMNS=0 2009-09-03 21:07:06 +02:00
Martin Geisler
d2c1c263b4 minirst: parse field lists 2009-08-02 23:38:07 +02:00
Martin Geisler
e0160ceaeb minirst: simplify bullet list indentation computation 2009-08-02 21:29:15 +02:00
Martin Geisler
65b64640d1 minirst: indent literal blocks with two spaces
The vast majority* of them are formatted like this in the source, so
this basically reverts the output to how it looked before we got the
minirst parser.

*: the help on templating use four spaces for some examples and will
   now shown with an indentation of just two spaces.
2009-08-02 17:17:17 +02:00
Martin Geisler
7953ecf0bd minimal reStructuredText parser 2009-07-16 23:25:25 +02:00
Martin Geisler
1a33bb5ceb minirst: improve layout of field lists
Before, we used the padding following the key to compute where to wrap
the text. Long keys would thus give a big indentation. It also
required careful alignment of the source text, making it cumbersome to
items to the list.

We now compute the maximum key length and use that for all items in
the list. We also put a cap on the indentation: keys longer than 10
characters are put on their own line. This is similar to how rst2html
handles large keys: it uses 14 as the cutoff point, but I felt that 10
was better for monospaced text in the console.
2009-12-13 23:49:53 +01:00
Martin Geisler
d96f024a4b minirst: don't test regexps twice
We know the regexps match since splitparagraphs used them too.
2009-12-13 22:37:30 +01:00
Martin Geisler
e1df25704d minirst: run inlineliterals too in debug mode 2009-12-13 19:24:24 +01:00