changeset 9739:75cff8f12910

minirst: support enumerated lists
author Martin Geisler <mg@lazybytes.net>
date Sat, 07 Nov 2009 03:14:56 +0100
parents f52c4f7a4732
children 2ebe679fec21
files mercurial/minirst.py tests/test-minirst.py tests/test-minirst.py.out
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Sat Nov 07 03:04:46 2009 +0100
+++ b/mercurial/minirst.py	Sat Nov 07 03:14:56 2009 +0100
@@ -107,7 +107,7 @@
         i += 1
     return blocks
 
-_bulletre = re.compile(r'- ')
+_bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)) ')
 _optionre = re.compile(r'^(--[a-z-]+)((?:[ =][a-zA-Z][\w-]*)?  +)(.*)$')
 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):( +)(.*)')
 _definitionre = re.compile(r'[^ ]')
--- a/tests/test-minirst.py	Sat Nov 07 03:04:46 2009 +0100
+++ b/tests/test-minirst.py	Sat Nov 07 03:14:56 2009 +0100
@@ -93,6 +93,15 @@
 
   Literal block with no indentation (apart from
   the two spaces added to all literal blocks).
+
+1. This is an enumerated list (first item).
+2. Continuing with the second item.
+
+(1) foo
+(2) bar
+
+1) Another
+2) List
 """
 
 debugformat('lists', lists, 60)
--- a/tests/test-minirst.py.out	Sat Nov 07 03:04:46 2009 +0100
+++ b/tests/test-minirst.py.out	Sat Nov 07 03:14:56 2009 +0100
@@ -113,6 +113,13 @@
 
   Literal block with no indentation (apart from
   the two spaces added to all literal blocks).
+
+1. This is an enumerated list (first item).
+2. Continuing with the second item.
+(1) foo
+(2) bar
+1) Another
+2) List
 ----------------------------------------------------------------------
 
 lists formatted to fit within 30 characters:
@@ -141,6 +148,15 @@
 
   Literal block with no indentation (apart from
   the two spaces added to all literal blocks).
+
+1. This is an enumerated list
+   (first item).
+2. Continuing with the second
+   item.
+(1) foo
+(2) bar
+1) Another
+2) List
 ----------------------------------------------------------------------
 
 options formatted to fit within 60 characters: