@@ -300,12 +300,6 @@ class OListProcessor(BlockProcessor):
300300 """ Process ordered list blocks. """
301301
302302 TAG = 'ol'
303- # Detect an item (``1. item``). ``group(1)`` contains contents of item.
304- RE = re .compile (r'^[ ]{0,3}\d+\.[ ]+(.*)' )
305- # Detect items on secondary lines. they can be of either list type.
306- CHILD_RE = re .compile (r'^[ ]{0,3}((\d+\.)|[*+-])[ ]+(.*)' )
307- # Detect indented (nested) items of either type
308- INDENT_RE = re .compile (r'^[ ]{4,7}((\d+\.)|[*+-])[ ]+.*' )
309303 # The integer (python string) with which the lists starts (default=1)
310304 # Eg: If list is intialized as)
311305 # 3. Item
@@ -314,6 +308,20 @@ class OListProcessor(BlockProcessor):
314308 # List of allowed sibling tags.
315309 SIBLING_TAGS = ['ol' , 'ul' ]
316310
311+ def __init__ (self , parser ):
312+ BlockProcessor .__init__ (self , parser )
313+ # Detect an item (``1. item``). ``group(1)`` contains contents of item.
314+ self .RE = re .compile ('' .join ([
315+ r'^[ ]{0,' , str (self .tab_length - 1 ), r'}\d+\.[ ]+(.*)' ]))
316+ # Detect items on secondary lines. they can be of either list type.
317+ self .CHILD_RE = re .compile ('' .join ([
318+ r'^[ ]{0,' , str (self .tab_length - 1 ), '}((\d+\.)|[*+-])[ ]+(.*)' ]))
319+ # Detect indented (nested) items of either type
320+ self .INDENT_RE = re .compile ('' .join ([
321+ r'^[ ]{' , str (self .tab_length ), ',' , str (self .tab_length * 2 - 1 ),
322+ r'}((\d+\.)|[*+-])[ ]+.*' ]))
323+
324+
317325 def test (self , parent , block ):
318326 return bool (self .RE .match (block ))
319327
@@ -407,7 +415,12 @@ class UListProcessor(OListProcessor):
407415 """ Process unordered list blocks. """
408416
409417 TAG = 'ul'
410- RE = re .compile (r'^[ ]{0,3}[*+-][ ]+(.*)' )
418+
419+ def __init__ (self , parser ):
420+ OListProcessor .__init__ (self , parser )
421+ # Detect an item (``1. item``). ``group(1)`` contains contents of item.
422+ self .RE = re .compile ('' .join ([
423+ r'^[ ]{0,' , str (self .tab_length - 1 ), r'}[*+-][ ]+(.*)' ]))
411424
412425
413426class HashHeaderProcessor (BlockProcessor ):
0 commit comments