From 99e1def1bb58507d0429345ac8b37b8c955cb63b Mon Sep 17 00:00:00 2001 From: Tom Price Date: Thu, 7 Jan 2016 23:56:01 +0000 Subject: [PATCH] Improved list handling in RML --- RIGS/templates/RIGS/event_print_page.xml | 2 +- RIGS/templatetags/markdown_tags.py | 17 ++++++++--------- db.sqlite3 | Bin 122880 -> 126976 bytes 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/RIGS/templates/RIGS/event_print_page.xml b/RIGS/templates/RIGS/event_print_page.xml index 2de4b74f..83b53fe6 100644 --- a/RIGS/templates/RIGS/event_print_page.xml +++ b/RIGS/templates/RIGS/event_print_page.xml @@ -189,7 +189,7 @@ {{ item.name }} {% if item.description %} - + {{ item.description|markdown:"rml" }} diff --git a/RIGS/templatetags/markdown_tags.py b/RIGS/templatetags/markdown_tags.py index ce8826d6..52d04cf4 100644 --- a/RIGS/templatetags/markdown_tags.py +++ b/RIGS/templatetags/markdown_tags.py @@ -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'): diff --git a/db.sqlite3 b/db.sqlite3 index 315850dbfffb33f9f2c17f4bc6c452df50509cef..44083137ab4692098be8faa69e25a79ad52af61e 100644 GIT binary patch delta 747 zcmZ{hOK1~O6o&7)C+$ooQ*3Q)LZ@?Sp^^%1GBYtX4b&tB@qy5V=|WJd_^j2gEci$z zsYG{@GL}n_iY^pEP|JX$yROrfi`Ipu7(rCTt^;nonQ9SAH$Ml?`Tp}NEJ=mWQdw(q z2qF2o?ld@yXQq{A7TSw(uot1--cb6%a&7^(eMbTA$t zGUAM37A(UY95BoQ<3P9Nr7bIJCKCzM)SZR;B}wkXq!^Rr=T$f&<6#`ZVN5zjbqd@n zz!U^U^0q1DmLcS3OvsHWKaTJY8BTI32*YCh2=d7gRFKgMmt+|7(Py+GMjxZ$0BUgl z!o{=GSFf}GV%=R-;DjG7lo}?dW$eH> z(mhI#xf={R=66f9M(`uP!V;dsI4ZOzuw|Nyux65N@oU>|y!C>=dq?yg3b&r|uds{1 zaUp2GuB+~t3orYW7IAMNIYM%FQ9Y*I-xpKJF8`hf5jXoDGQgjFfU0}B3LHRxy9N)b zYH2n)j$Od(GOk40)DZSkCa@d3X-&4-`_d A0{{R3 delta 298 zcmW-aze_?<97pfxezp62KEg;+e6L?%L=-}cIE=Dc>0S$(2YB&`E{d)`*85Q+hW{a%O4kFC$He|`%>mRcm3so7f>Wz4bTjyD%*kbQY*G3L>x(B;y4Ui!