1919"""
2020import uuid
2121from urllib .parse import urlparse , urlsplit , urlunsplit , quote , unquote
22+ from collections import OrderedDict
2223
2324from textile .tools import sanitizer , imagesize
2425from textile .regex_strings import (align_re_s , cls_re_s , pnct_re_s ,
2829 parse_attributes , pba )
2930from textile .objects import Block , Table
3031
31- from collections import OrderedDict
32-
33-
3432try :
3533 import regex as re
3634except ImportError :
@@ -254,7 +252,6 @@ def parse(self, text, rel=None, sanitize=False):
254252
255253 if not self .lite :
256254 text = self .placeNoteLists (text )
257-
258255 text = self .retrieve (text )
259256 text = text .replace ('{0}:glyph:' .format (self .uid ), '' )
260257
@@ -322,7 +319,7 @@ def fTextileList(self, match):
322319
323320 # does the first line of this ol have a start attribute
324321 if len (tl ) > len (pt ):
325- # no, set it to 1
322+ # no, set it to 1.
326323 if start is None :
327324 self .olstarts [tl ] = 1
328325 # yes, set it to the given number
@@ -360,8 +357,8 @@ def fTextileList(self, match):
360357
361358 atts = pba (atts , restricted = self .restricted )
362359 tabs = '\t ' * len (tl )
363- # If start is still None, set it to '', else leave the value
364- # that we've already formatted.
360+ # If start is still None, set it to '', else leave the value that
361+ # we've already formatted.
365362 start = start or ''
366363 # if this item tag isn't in the list, create a new list and
367364 # item, else just create the item
@@ -374,7 +371,6 @@ def fTextileList(self, match):
374371 line = ("\t <{0}{1}>{2}" .format (litem , atts , content ) if
375372 showitem else '' )
376373 line = '{0}{1}' .format (tabs , line )
377-
378374 if len (nl ) <= len (tl ):
379375 if showitem :
380376 line = "{0}</{1}>" .format (line , litem )
@@ -387,12 +383,12 @@ def fTextileList(self, match):
387383 if len (k ) > 1 and v != 2 :
388384 line = "{0}</{1}>" .format (line , litem )
389385 del ls [k ]
390- # Remember the current Textile tag
386+ # Remember the current Textile tag:
391387 pt = tl
392388 # This else exists in the original php version. I'm not sure how
393389 # to come up with a case where the line would not match. I think
394390 # it may have been necessary due to the way php returns matches.
395- #else:
391+ # else:
396392 #line = "{0}\n".format(line)
397393 result .append (line )
398394 return self .doTagBr (litem , "\n " .join (result ))
@@ -416,7 +412,6 @@ def block(self, text):
416412 tre = '|' .join (self .btag )
417413 else :
418414 tre = '|' .join (self .btag_lite )
419-
420415 # split the text by two or more newlines, retaining the newlines in the
421416 # split list
422417 text = re .split (r'(\n{2,})' , text )
@@ -527,7 +522,6 @@ def block(self, text):
527522 multiline_para = True
528523 else :
529524 line = self .doPBr (line )
530-
531525 if not block .tag == 'p' :
532526 multiline_para = False
533527
@@ -554,7 +548,7 @@ def block(self, text):
554548 eat_whitespace = True
555549
556550 # at this point, we've gone through all the lines. if there's still an
557- # extension in effect, we close it here.
551+ # extension in effect, we close it here
558552 if ext and out and not block .tag == 'p' :
559553 block .content = out .pop ()
560554 block .process ()
@@ -584,7 +578,6 @@ def footnoteID(self, m):
584578 footref = generate_tag ('sup' , footref , fn_att )
585579 return '{0}{1}' .format (footref , m .group ('space' ))
586580
587-
588581 def glyphs (self , text ):
589582 """
590583 Because of the split command, the regular expressions are different for
0 commit comments