ul and li conversion

This commit is contained in:
Matthew Tretter
2012-06-29 13:19:58 -04:00
parent a2788df401
commit e28b2fc7f6
2 changed files with 14 additions and 0 deletions

View File

@@ -83,6 +83,14 @@ class MarkdownConverter(object):
def convert_i(self, el):
return self.convert_em(el)
def convert_li(self, el):
parent = el.getparent()
if parent is not None and parent.tag == 'ol':
bullet = '%s.' % (parent.index(el) + 1)
else:
bullet = '*'
return '%s %s\n' % (bullet, el.text or '')
def convert_strong(self, el):
return '**%s**' % el.text if el.text else ''