[Doc-SIG] reST ordered list syntax extension
Andrew Harrington
anh at math.luc.edu
Sun Jan 2 00:05:17 CET 2005
Desired feature change in restructured text (reST) ordered lists:
Being able to add ordered list entries to the middle of a list without
renumbering would be very useful.
If I start with:
1. first
2. second
a. sub a
para
b. sub b
3. third
And I want to insert entry NEW after 1, I must renumber:
1. first
2. NEW
3. second
a. sub a
para
b. sub b
4. third
I suggest that the first entry in a list start with the actual format
desired, but for later entries allow '#':
1. first
#. second
a. sub a
para
#. sub b
#. third
which would make the insertion easy:
1. first
#. NEW
#. second
a. sub a
para
#. sub b
#. third
The parser already keeps track of what the next sequence identifier would
be and issues errors if they are wrong. Why not just allow the # with the
same punctuation after it and indentation before as in the first entry,
and rather than declaring an error, substitute in the next in the
sequence?
An extension could allow fully labeled sublist entries If you wanted:
1. first
2. second
2.a. sub a
para
2.b. sub b
3. third
you could use in the extended reST:
1. first
#. second
#.a. sub a
para
#.#. sub b
#. third
The assumption is that if a first sub entry starts with one or more '#'
and punctuation (the '#.' here), they are assumed to be repeats of the
current outer levels, and there must be an explicit subsequence starter in
addition (the 'a' here). I have written in that further sub entries must
have the same prefix ('#.' here) as the first subentry. A more concise
alternative would be to _assume the same prefix, and just allow
#.#. sub b
to be
#. sub b
I am not sure if the latter alternative should be indented to match the
first instead of the second '#' in the alternate version above.
The punctuation is important to be included explicitly if desired.
If I gave input
#a. sub a
I would get out the more concise output
2a. sub a
Comments?
Thanks
Andy Harrington
More information about the Doc-SIG
mailing list