mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-21 23:42:14 +00:00
FIX: Re-enable markdown on paperwork
Strikethrough is broken in all sorts of places for whatever reason
This commit is contained in:
@@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
<blockTableStyle id="eventSpecifics">
|
<blockTableStyle id="eventSpecifics">
|
||||||
<blockValign value="top"/>
|
<blockValign value="top"/>
|
||||||
<lineStyle kind="LINEAFTER" colorName="LightGrey" start="0,0" stop="1,0" thickness="1"/>
|
<lineStyle kind="LINEAFTER" colorName="LightGrey" start="0,0" stop="1,0" thickness="1"/>
|
||||||
</blockTableStyle>
|
</blockTableStyle>
|
||||||
|
|
||||||
<blockTableStyle id="headLayout">
|
<blockTableStyle id="headLayout">
|
||||||
<blockValign value="top"/>
|
<blockValign value="top"/>
|
||||||
|
|
||||||
</blockTableStyle>
|
</blockTableStyle>
|
||||||
|
|
||||||
<blockTableStyle id="eventDetails">
|
<blockTableStyle id="eventDetails">
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
{# logo positioned 42 from left, 33 from top #}
|
{# logo positioned 42 from left, 33 from top #}
|
||||||
<image file="RIGS/static/imgs/paperwork/tec-logo.jpg" x="42" y="719" height="90" width="84"/>
|
<image file="RIGS/static/imgs/paperwork/tec-logo.jpg" x="42" y="719" height="90" width="84"/>
|
||||||
|
|
||||||
<setFont name="OpenSans-Bold" size="22.5" leading="10"/>
|
<setFont name="OpenSans-Bold" size="22.5" leading="10"/>
|
||||||
<drawString x="137" y="780">TEC PA & Lighting</drawString>
|
<drawString x="137" y="780">TEC PA & Lighting</drawString>
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
<drawString x="265" y="746">info@nottinghamtec.co.uk</drawString>
|
<drawString x="265" y="746">info@nottinghamtec.co.uk</drawString>
|
||||||
<drawString x="137" y="732">Phone: (0115) 846 8720</drawString>
|
<drawString x="137" y="732">Phone: (0115) 846 8720</drawString>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<setFont name="OpenSans" size="10" />
|
<setFont name="OpenSans" size="10" />
|
||||||
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
[Paperwork generated{% if current_user %} by {{current_user.name}} |{% endif %} {% now "d/m/Y H:i" %} | {{object.current_version_id}}]
|
[Paperwork generated{% if current_user %} by {{current_user.name}} |{% endif %} {% now "d/m/Y H:i" %} | {{object.current_version_id}}]
|
||||||
</drawCenteredString>
|
</drawCenteredString>
|
||||||
</pageGraphics>
|
</pageGraphics>
|
||||||
|
|
||||||
<frame id="main" x1="50" y1="65" width="495" height="645"/>
|
<frame id="main" x1="50" y1="65" width="495" height="645"/>
|
||||||
</pageTemplate>
|
</pageTemplate>
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
<pageGraphics>
|
<pageGraphics>
|
||||||
<image file="RIGS/static/imgs/paperwork/corner-tr.jpg" x="395" y="642" height="200" width="200"/>
|
<image file="RIGS/static/imgs/paperwork/corner-tr.jpg" x="395" y="642" height="200" width="200"/>
|
||||||
<image file="RIGS/static/imgs/paperwork/corner-bl.jpg" x="0" y="0" height="200" width="200"/>
|
<image file="RIGS/static/imgs/paperwork/corner-bl.jpg" x="0" y="0" height="200" width="200"/>
|
||||||
|
|
||||||
<setFont name="OpenSans" size="10"/>
|
<setFont name="OpenSans" size="10"/>
|
||||||
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
||||||
<setFont name="OpenSans" size="7" />
|
<setFont name="OpenSans" size="7" />
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
{% load markdown_tags %}
|
||||||
|
|
||||||
<setNextFrame name="main"/>
|
<setNextFrame name="main"/>
|
||||||
<nextFrame/>
|
<nextFrame/>
|
||||||
|
|
||||||
|
|
||||||
<blockTable style="headLayout" colWidths="330,165">
|
<blockTable style="headLayout" colWidths="330,165">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@@ -12,9 +13,7 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<keepInFrame>
|
<keepInFrame>
|
||||||
<para style="style.event_description">
|
{{ object.description|default_if_none:""|markdown:"rml" }}
|
||||||
{{ object.description|default_if_none:""|linebreaksbr }}
|
|
||||||
</para>
|
|
||||||
</keepInFrame>
|
</keepInFrame>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -114,7 +113,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td rightPadding="0">
|
<td rightPadding="0">
|
||||||
|
|
||||||
<h2>Timings</h2>
|
<h2>Timings</h2>
|
||||||
<blockTable style="eventDetails" colWidths="55,75">
|
<blockTable style="eventDetails" colWidths="55,75">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -184,9 +183,9 @@
|
|||||||
<para>{{ item.name }}
|
<para>{{ item.name }}
|
||||||
{% if item.description %}
|
{% if item.description %}
|
||||||
</para>
|
</para>
|
||||||
<para style="item_description">
|
<indent left="0.6cm">
|
||||||
<em>{{ item.description|linebreaksbr }}</em>
|
{{ item.description|markdown:"rml" }}
|
||||||
</para>
|
</indent>
|
||||||
<para>
|
<para>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</para>
|
</para>
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ __author__ = 'ghost'
|
|||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@register.filter(name="markdown")
|
@register.filter(name="markdown")
|
||||||
def markdown_filter(text, format='html'):
|
def markdown_filter(text, input_format='html'):
|
||||||
# markdown library can't handle text=None
|
# markdown library can't handle text=None
|
||||||
if text is None:
|
if text is None:
|
||||||
return text
|
return text
|
||||||
html = markdown.markdown(text, extensions=['markdown.extensions.nl2br'])
|
html = markdown.markdown(text, extensions=['markdown.extensions.nl2br'])
|
||||||
if format == 'html':
|
if input_format == 'html':
|
||||||
return mark_safe('<div class="markdown">' + html + '</div>')
|
return mark_safe('<div class="markdown">' + html + '</div>')
|
||||||
elif format == 'rml':
|
elif input_format == 'rml':
|
||||||
# Convert format to RML
|
# Convert format to RML
|
||||||
soup = BeautifulSoup(html, "html.parser")
|
soup = BeautifulSoup(html, "html.parser")
|
||||||
|
|
||||||
@@ -33,22 +33,20 @@ def markdown_filter(text, format='html'):
|
|||||||
bq.name = 'pre'
|
bq.name = 'pre'
|
||||||
bq.string = bq.text
|
bq.string = bq.text
|
||||||
|
|
||||||
for list in soup.findAll(['ul','ol']):
|
for alist in soup.find_all(['ul','ol']):
|
||||||
list['style'] = list.name
|
alist['style'] = alist.name
|
||||||
for li in list.findAll('li', recursive=False):
|
for li in alist.find_all('li', recursive=False):
|
||||||
text = li.find(text=True)
|
text = li.find(text=True)
|
||||||
text.wrap(soup.new_tag('p'))
|
text.wrap(soup.new_tag('p'))
|
||||||
|
|
||||||
if list.parent.name != 'li':
|
if alist.parent.name != 'li':
|
||||||
indent = soup.new_tag('indent')
|
indent = soup.new_tag('indent')
|
||||||
indent['left'] = '0.6cm'
|
indent['left'] = '0.6cm'
|
||||||
|
|
||||||
list.wrap(indent)
|
alist.wrap(indent)
|
||||||
|
|
||||||
# Paragraphs have a different tag
|
# Paragraphs have a different tag
|
||||||
for p in soup('p'):
|
for p in soup('p'):
|
||||||
p.name = 'para'
|
p.name = 'para'
|
||||||
|
|
||||||
# @todo: <ul> and <li> tags to not appear to be working
|
return mark_safe(str(soup))
|
||||||
|
|
||||||
return mark_safe(soup)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user