Skip to content

Commit 86904ba

Browse files
committed
more pythonic litem tagging.
1 parent b27d3d2 commit 86904ba

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

textile/core.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,18 +457,14 @@ def fTextileList(self, match):
457457
except IndexError:
458458
nextline = ''
459459

460-
m = re.search(r"^([#*;:]+)(_|\d+)?({0})[ .](.*)$".format(cls_re_s),
461-
line, re.S)
460+
m = re.search(r"^(?P<tl>[#*;:]+)(?P<st>_|\d+)?(?P<atts>{0})[ .]"
461+
"(?P<content>.*)$".format(cls_re_s), line, re.S)
462462
tl, start, atts, content = m.groups()
463463
content = content.strip()
464464
nl = ''
465465
ltype = list_type(tl)
466-
if ';' in tl:
467-
litem = 'dt'
468-
elif ':' in tl:
469-
litem = 'dd'
470-
else:
471-
litem = 'li'
466+
tl_tags = {';': 'dt', ':': 'dd'}
467+
litem = tl_tags.get(tl[0], 'li')
472468

473469
showitem = len(content) > 0
474470

0 commit comments

Comments
 (0)