2727from textile .utils import (decode_high , encode_high , encode_html , generate_tag ,
2828 has_raw_text , is_rel_url , is_valid_url , list_type , normalize_newlines ,
2929 parse_attributes , pba )
30- from textile .objects import Block , List , Table
30+ from textile .objects import Block , Table
3131
3232
3333try :
@@ -297,7 +297,7 @@ def textileLists(self, text):
297297 return pattern .sub (self .fTextileList , text )
298298
299299 def fTextileList (self , match ):
300- text = re .split (r'\n(?=[*#;:]+\s )' , match .group (), flags = re .M )
300+ text = re .split (r'\n(?=[*#;:])' , match .group (), flags = re .M )
301301 # import pdb; pdb.set_trace()
302302 pt = ''
303303 result = []
@@ -310,15 +310,15 @@ def fTextileList(self, match):
310310
311311 m = re .search (r"^(?P<tl>[#*;:]+)(?P<st>_|\d+)?(?P<atts>{0})[ .]"
312312 "(?P<content>.*)$" .format (cls_re_s ), line , re .S )
313- tl , start , atts , content = m .groups ()
314- attributes = parse_attributes (atts )
315- content = content .strip ()
316- if '\n ' in content :
317- content = content .replace ('\n ' , '<br />\n ' )
313+ if m :
314+ tl , start , atts , content = m .groups ()
315+ content = content .strip ()
316+ else :
317+ result .append (line )
318+ break
319+
318320 nl = ''
319321 ltype = list_type (tl )
320- if i == 0 :
321- _list = List ('{0}l' .format (ltype ), attributes )
322322 tl_tags = {';' : 'dt' , ':' : 'dd' }
323323 litem = tl_tags .get (tl [0 ], 'li' )
324324
@@ -343,7 +343,6 @@ def fTextileList(self, match):
343343 # put together the start attribute if needed
344344 if len (tl ) > len (pt ) and start is not None :
345345 start = ' start="{0}"' .format (self .olstarts [tl ])
346- _list .attributes ['start' ] = str (self .olstarts [tl ])
347346
348347 # This will only increment the count for list items, not
349348 # definition items
@@ -371,19 +370,12 @@ def fTextileList(self, match):
371370 # item, else just create the item
372371 if tl not in ls :
373372 ls [tl ] = 1
374- if i == 0 :
375- _list .add_item (litem , content )
376- else :
377- itemtag = ("\n {0}\t <{1}>{2}" .format (tabs , litem , content ) if
378- showitem else '' )
379- _sublist = List (litem , attributes )
380- line = "<{0}l{1}{2}>{3}" .format (ltype , atts , start , itemtag )
381- _sublist .add_item (litem , content )
382- line = _sublist .process ()
373+ itemtag = ("\n {0}\t <{1}>{2}" .format (tabs , litem , content ) if
374+ showitem else '' )
375+ line = "<{0}l{1}{2}>{3}" .format (ltype , atts , start , itemtag )
383376 else :
384377 line = ("\t <{0}{1}>{2}" .format (litem , atts , content ) if
385378 showitem else '' )
386- _list .add_item (litem , content , attributes )
387379 line = '{0}{1}' .format (tabs , line )
388380
389381 if len (nl ) <= len (tl ):
@@ -408,7 +400,7 @@ def fTextileList(self, match):
408400 #else:
409401 #line = "{0}\n".format(line)
410402 result .append (line )
411- return self .doTagBr (litem , _list . process ( ))
403+ return self .doTagBr (litem , " \n " . join ( result ))
412404
413405 def doTagBr (self , tag , input ):
414406 return re .compile (r'<({0})([^>]*?)>(.*)(</\1>)' .format (re .escape (tag )),
0 commit comments