diff --git a/RIGS/templates/RIGS/event_print.xml b/RIGS/templates/RIGS/event_print.xml index 92950f41..a37581bd 100644 --- a/RIGS/templates/RIGS/event_print.xml +++ b/RIGS/templates/RIGS/event_print.xml @@ -33,12 +33,12 @@ - + - + @@ -95,7 +95,7 @@ {# logo positioned 42 from left, 33 from top #} - + TEC PA & Lighting @@ -105,7 +105,7 @@ info@nottinghamtec.co.uk Phone: (0115) 846 8720 - + [Page of ] @@ -114,7 +114,7 @@ [Paperwork generated{% if current_user %} by {{current_user.name}} |{% endif %} {% now "d/m/Y H:i" %} | {{object.current_version_id}}] - + @@ -122,7 +122,7 @@ - + [Page of ] diff --git a/RIGS/templates/RIGS/event_print_page.xml b/RIGS/templates/RIGS/event_print_page.xml index 4b1ddfdf..2837c39c 100644 --- a/RIGS/templates/RIGS/event_print_page.xml +++ b/RIGS/templates/RIGS/event_print_page.xml @@ -1,7 +1,8 @@ +{% load markdown_tags %} + - @@ -12,9 +13,7 @@ - - {{ object.description|default_if_none:""|linebreaksbr }} - + {{ object.description|default_if_none:""|markdown:"rml" }} @@ -114,7 +113,7 @@ {% endif %} - +

Timings

@@ -184,9 +183,9 @@ {{ item.name }} {% if item.description %} - - {{ item.description|linebreaksbr }} - + + {{ item.description|markdown:"rml" }} + {% endif %} diff --git a/RIGS/templatetags/markdown_tags.py b/RIGS/templatetags/markdown_tags.py index 4b761da2..36699bec 100644 --- a/RIGS/templatetags/markdown_tags.py +++ b/RIGS/templatetags/markdown_tags.py @@ -8,14 +8,14 @@ __author__ = 'ghost' register = template.Library() @register.filter(name="markdown") -def markdown_filter(text, format='html'): +def markdown_filter(text, input_format='html'): # markdown library can't handle text=None if text is None: return text html = markdown.markdown(text, extensions=['markdown.extensions.nl2br']) - if format == 'html': + if input_format == 'html': return mark_safe('
' + html + '
') - elif format == 'rml': + elif input_format == 'rml': # Convert format to RML soup = BeautifulSoup(html, "html.parser") @@ -33,22 +33,20 @@ def markdown_filter(text, format='html'): bq.name = 'pre' bq.string = bq.text - for list in soup.findAll(['ul','ol']): - list['style'] = list.name - for li in list.findAll('li', recursive=False): + for alist in soup.find_all(['ul','ol']): + alist['style'] = alist.name + for li in alist.find_all('li', recursive=False): text = li.find(text=True) text.wrap(soup.new_tag('p')) - if list.parent.name != 'li': + if alist.parent.name != 'li': indent = soup.new_tag('indent') indent['left'] = '0.6cm' - list.wrap(indent) + alist.wrap(indent) # Paragraphs have a different tag for p in soup('p'): p.name = 'para' - # @todo:
    and
  • tags to not appear to be working - - return mark_safe(soup) + return mark_safe(str(soup))