Improved list handling in RML

This commit is contained in:
Tom Price
2016-01-07 23:56:01 +00:00
parent 7e0e6b6b3e
commit 99e1def1bb
3 changed files with 9 additions and 10 deletions

View File

@@ -189,7 +189,7 @@
<para>{{ item.name }}
{% if item.description %}
</para>
<indent left="0.5cm">
<indent left="0.6cm">
{{ item.description|markdown:"rml" }}
</indent>
<para>

View File

@@ -32,16 +32,15 @@ def markdown_filter(text, format='html'):
for list in soup.findAll(['ul','ol']):
list['style'] = list.name
for li in list.findAll('li'):
p = soup.new_tag('p')
p.string = li.text
li.string = ''
li.append(p)
indent = soup.new_tag('indent')
indent['left'] = '1.2cm'
for li in list.findAll('li', recursive=False):
text = li.find(text=True)
text.wrap(soup.new_tag('p'))
content = list.replace_with(indent)
indent.append(content)
if list.parent.name != 'li':
indent = soup.new_tag('indent')
indent['left'] = '0.6cm'
list.wrap(indent)
# Paragraphs have a different tag
for p in soup('p'):

Binary file not shown.