Add processing for <ul> in RML

This commit is contained in:
Tom Price
2016-01-07 20:02:07 +00:00
parent 088e23749d
commit 2d3262cb0b
3 changed files with 170 additions and 132 deletions

View File

@@ -5,15 +5,19 @@
{% if invoice %} {% if invoice %}
<blockTable style="invoiceLayout" colWidths="330,165"> <blockTable style="invoiceLayout" colWidths="330,165">
<tr> <tr>
<td> <td>
{% endif %} {% endif %}
<h1><b>N{{ object.pk|stringformat:"05d" }}:</b> '{{ object.name }}'<small></small></h1> <h1>
<b>N{{ object.pk|stringformat:"05d" }}:</b>
'{{ object.name }}'
<small></small>
</h1>
<para style="style.event_description"> <para style="style.event_description">
<b>{{object.start_date|date:"D jS N Y"}}</b> <b>{{ object.start_date|date:"D jS N Y" }}</b>
</para> </para>
<keepInFrame> <keepInFrame>
@@ -28,19 +32,25 @@
<spacer length="10"/> <spacer length="10"/>
<blockTable style="eventDetails" colWidths="100,175"> <blockTable style="eventDetails" colWidths="100,175">
<tr> <tr>
<td><para style="invoice_titles">Invoice Number</para></td> <td>
<para style="invoice_titles">Invoice Number</para>
</td>
<td> <td>
<para style="invoice_numbers">{{ invoice.pk|stringformat:"05d" }}</para> <para style="invoice_numbers">{{ invoice.pk|stringformat:"05d" }}</para>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><para style="invoice_titles">Invoice Date</para></td> <td>
<para style="invoice_titles">Invoice Date</para>
</td>
<td> <td>
<para style="invoice_numbers">{{ invoice.invoice_date|date:"d/m/Y" }}</para> <para style="invoice_numbers">{{ invoice.invoice_date|date:"d/m/Y" }}</para>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><para style="invoice_titles">PO Number</para></td> <td>
<para style="invoice_titles">PO Number</para>
</td>
<td> <td>
<para style="invoice_numbers">{{ object.purchase_order|default_if_none:"" }}</para> <para style="invoice_numbers">{{ object.purchase_order|default_if_none:"" }}</para>
</td> </td>
@@ -48,94 +58,100 @@
</blockTable> </blockTable>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
{% endif %} {% endif %}
<spacer length="15"/> <spacer length="15"/>
<blockTable style="eventSpecifics" colWidths="165,165,165"> <blockTable style="eventSpecifics" colWidths="165,165,165">
<tr> <tr>
<td leftPadding="0"> <td leftPadding="0">
<h2>Hirer</h2> <h2>Hirer</h2>
<h3>{{ object.person.name }}</h3> <h3>{{ object.person.name }}</h3>
<h3>{{ object.organisation.name|default_if_none:"" }}</h3> <h3>{{ object.organisation.name|default_if_none:"" }}</h3>
{% if invoice %} {% if invoice %}
<keepInFrame>
{% if object.organisation.address %}
<para style="specific_description">{{ object.organisation.address|default_if_none:""|linebreaksbr }}</para>
{% elif object.person.address %}
<para style="specific_description">{{ object.person.address|default_if_none:""|linebreaksbr }}</para>
{% endif %}
</keepInFrame>
{% endif %}
<keepInFrame>
{% if object.person.phone %}
<para style="specific_description">{{ object.person.phone }}</para>
{% elif object.organisation.phone %}
<para style="specific_description">{{ object.organisation.phone }}</para>
{% endif %}
</keepInFrame>
<keepInFrame>
{% if invoice %}
{% if object.organisation.email %}
<para style="specific_description">{{ object.organisation.email }}</para>
{% elif object.person.email %}
<para style="specific_description">{{ object.person.email }}</para>
{% endif %}
{% else %}
{% if object.person.email %}
<para style="specific_description">{{ object.person.email }}</para>
{% elif object.organisation.email %}
<para style="specific_description">{{ object.organisation.email }}</para>
{% endif %}
{% endif %}
</keepInFrame>
</td>
<td>
<h2>Venue</h2>
<h3>{{ object.venue.name }}</h3>
{% if not invoice %}
<keepInFrame> <keepInFrame>
<para style="specific_description">{{ object.venue.address|default_if_none:""|linebreaksbr }}</para> {% if object.organisation.address %}
<para style="specific_description">{{ object.organisation.address|default_if_none:""|linebreaksbr }}</para>
{% elif object.person.address %}
<para style="specific_description">{{ object.person.address|default_if_none:""|linebreaksbr }}</para>
{% endif %}
</keepInFrame> </keepInFrame>
{% endif %}
<keepInFrame>
{% if object.person.phone %}
<para style="specific_description">{{ object.person.phone }}</para>
{% elif object.organisation.phone %}
<para style="specific_description">{{ object.organisation.phone }}</para>
{% endif %} {% endif %}
</td> </keepInFrame>
<td rightPadding="0"> <keepInFrame>
{% if invoice %}
<h2>Timings</h2> {% if object.organisation.email %}
<blockTable style="eventDetails" colWidths="55,75"> <para style="specific_description">{{ object.organisation.email }}</para>
{% elif object.person.email %}
<para style="specific_description">{{ object.person.email }}</para>
{% endif %}
{% else %}
{% if object.person.email %}
<para style="specific_description">{{ object.person.email }}</para>
{% elif object.organisation.email %}
<para style="specific_description">{{ object.organisation.email }}</para>
{% endif %}
{% endif %}
</keepInFrame>
</td>
<td>
<h2>Venue</h2>
<h3>{{ object.venue.name }}</h3>
{% if not invoice %}
<keepInFrame>
<para style="specific_description">{{ object.venue.address|default_if_none:""|linebreaksbr }}</para>
</keepInFrame>
{% endif %}
</td>
<td rightPadding="0">
<h2>Timings</h2>
<blockTable style="eventDetails" colWidths="55,75">
<tr>
<td leftPadding="0" topPadding="0">
<h3>Start</h3>
</td>
<td>
<para style="times">{{ object.start_time|time:"H:i" }}
{{ object.start_date|date:"d/m/Y" }}
</para>
</td>
</tr>
<tr>
<td leftPadding="0">
<h3>End</h3>
</td>
<td>
<para style="times">{{ object.end_time|default_if_none:""|time:"H:i" }}
{{ object.end_date|date:"d/m/Y" }}
</para>
</td>
</tr>
{% if object.access_at and not invoice %}
<tr> <tr>
<td leftPadding="0" topPadding="0"><h3>Start</h3></td> <td leftPadding="0">
<td> <h3>Access</h3>
<para style="times">{{ object.start_time|time:"H:i" }}
{{ object.start_date|date:"d/m/Y" }}
</para>
</td> </td>
</tr>
<tr>
<td leftPadding="0"><h3>End</h3></td>
<td>
<para style="times">{{ object.end_time|default_if_none:""|time:"H:i" }}
{{ object.end_date|date:"d/m/Y" }}
</para>
</td>
</tr>
{% if object.access_at and not invoice%}
<tr>
<td leftPadding="0"><h3>Access</h3></td>
<td> <td>
<para style="times">{{ object.access_at|time:"H:i" }} <para style="times">{{ object.access_at|time:"H:i" }}
{{ object.access_at|date:"d/m/Y" }} {{ object.access_at|date:"d/m/Y" }}
</para> </para>
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
</blockTable> </blockTable>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<spacer length="15"/> <spacer length="15"/>
@@ -173,12 +189,12 @@
<para>{{ item.name }} <para>{{ item.name }}
{% if item.description %} {% if item.description %}
</para> </para>
<indent left="1cm"> <indent left="0.5cm">
{{ item.description|markdown:"rml" }} {{ item.description|markdown:"rml" }}
</indent> </indent>
<para> <para>
{% endif %} {% endif %}
</para> </para>
</td> </td>
<td>£ {{ item.cost|floatformat:2 }}</td> <td>£ {{ item.cost|floatformat:2 }}</td>
<td>{{ item.quantity }}</td> <td>{{ item.quantity }}</td>
@@ -187,7 +203,7 @@
{% endfor %} {% endfor %}
</blockTable> </blockTable>
<keepTogether> <keepTogether>
<blockTable style="totalTable" colWidths="300,115,80"> <blockTable style="totalTable" colWidths="300,115,80">
<tr> <tr>
<td>{% if not invoice %}VAT Registration Number: 116252989{% endif %}</td> <td>{% if not invoice %}VAT Registration Number: 116252989{% endif %}</td>
<td>Total (ex. VAT)</td> <td>Total (ex. VAT)</td>
@@ -196,9 +212,9 @@
<tr> <tr>
<td> <td>
{% if not invoice %} {% if not invoice %}
<para> <para>
<b>The full hire fee is payable at least 10 days before the event.</b> <b>The full hire fee is payable at least 10 days before the event.</b>
</para> </para>
{% endif %} {% endif %}
</td> </td>
<td>VAT @ {{ object.vat_rate.as_percent|floatformat:2 }}%</td> <td>VAT @ {{ object.vat_rate.as_percent|floatformat:2 }}%</td>
@@ -206,7 +222,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<para> <para>
{% if invoice %} {% if invoice %}
VAT Registration Number: 116252989 VAT Registration Number: 116252989
@@ -214,7 +230,7 @@
<b>This contract is not an invoice.</b> <b>This contract is not an invoice.</b>
{% endif %} {% endif %}
</para> </para>
</td> </td>
<td> <td>
<para> <para>
@@ -227,92 +243,100 @@
</para> </para>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
</keepTogether> </keepTogether>
{% if not invoice %} {% if not invoice %}
<keepTogether> <keepTogether>
<blockTable style="infoTable"> <blockTable style="infoTable">
<tr> <tr>
<td> <td>
<para>Bookings will <para>Bookings will
<b>not</b> <b>not</b>
be confirmed until payment is received and the contract is signed. be confirmed until payment is received and the contract is signed.
</para> </para>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>24 Hour Emergency Contacts: 07825 065681 and 07825 065678</td> <td>24 Hour Emergency Contacts: 07825 065681 and 07825 065678</td>
</tr> </tr>
</blockTable> </blockTable>
</keepTogether> </keepTogether>
<spacer length="15"/> <spacer length="15"/>
<keepTogether> <keepTogether>
<para style="blockPara"> <para style="blockPara">
<b>To be signed on booking:</b> <b>To be signed on booking:</b>
</para> </para>
{% if object.organisation.union_account %} {% if object.organisation.union_account %}
<para style="blockPara"> <para style="blockPara">
<i> <i>
I agree that am authorised to sign this invoice. I agree that I am the President/Treasurer of the hirer, or I agree that am authorised to sign this invoice. I agree that I am the President/Treasurer of the hirer,
that I have provided written permission from either the President or Treasurer of the hirer stating that I can or
sign for this invoice. that I have provided written permission from either the President or Treasurer of the hirer stating that
</i> I can
sign for this invoice.
</i>
</para> </para>
<para style="blockPara"> <para style="blockPara">
<i> <i>
I have read, understood and fully accepted the current conditions of hire. I agree to return any dry hire I have read, understood and fully accepted the current conditions of hire. I agree to return any dry
items to TEC PA &amp; Lighting in the same condition at the end of the hire period. hire
</i> items to TEC PA &amp; Lighting in the same condition at the end of the hire period.
</i>
</para> </para>
<para style="blockPara"> <para style="blockPara">
<b> <b>
Conditions of hire attached and available on the TEC PA &amp; Lighting website. E&amp;OE Conditions of hire attached and available on the TEC PA &amp; Lighting website. E&amp;OE
</b> </b>
</para> </para>
<para style="blockPara"> <para style="blockPara">
Please return this form directly to TEC PA &amp; Lighting and not the Students' Union Finance Department. Please return this form directly to TEC PA &amp; Lighting and not the Students' Union Finance Department.
</para> </para>
<blockTable style="signatureTable" colWidths="70,100,325"> <blockTable style="signatureTable" colWidths="70,100,325">
<tr> <tr>
<td>Account Code</td> <td>Account Code</td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
</blockTable> </blockTable>
{% else %} {% else %}
<para style="blockPara"> <para style="blockPara">
<i> <i>
I, the hirer, have read, understand and fully accept the current conditions of hire. This document forms a I, the hirer, have read, understand and fully accept the current conditions of hire. This document forms
binding contract between TEC PA &amp; Lighting and the hirer, the aforementioned conditions of hire forming a
an integral part of it. binding contract between TEC PA &amp; Lighting and the hirer, the aforementioned conditions of hire
</i> forming
an integral part of it.
</i>
</para> </para>
<para style="blockPara"> <para style="blockPara">
<b> <b>
Conditions of hire attached and available on the TEC PA &amp; Lighting website. E&amp;OE Conditions of hire attached and available on the TEC PA &amp; Lighting website. E&amp;OE
</b> </b>
</para> </para>
{% include "RIGS/event_print_signature.xml" %} {% include "RIGS/event_print_signature.xml" %}
<spacer length="10"/> <spacer length="10"/>
<para style="blockPara"> <para style="blockPara">
<b>To be signed on the day of the event/hire:</b> <b>To be signed on the day of the event/hire:</b>
</para> </para>
<para style="blockPara"> <para style="blockPara">
<i> <i>
I, the hirer, have received the goods/services as requested and in good order. I agree to return any dry hire I, the hirer, have received the goods/services as requested and in good order. I agree to return any dry
items to TEC PA &amp; Lighting in a similar condition at the end of the hire period. hire
</i> items to TEC PA &amp; Lighting in a similar condition at the end of the hire period.
</i>
</para> </para>
{% endif %} {% endif %}
{% include "RIGS/event_print_signature.xml" %} {% include "RIGS/event_print_signature.xml" %}
</keepTogether> </keepTogether>
{% endif %} {% endif %}
<namedString id="lastPage"><pageNumber/></namedString> <namedString id="lastPage">
<pageNumber/>
</namedString>

View File

@@ -30,6 +30,20 @@ def markdown_filter(text, format='html'):
bq.name = 'pre' bq.name = 'pre'
bq.string = bq.text bq.string = bq.text
for ul in soup('ul'):
ul['value'] = 'square'
ul['bulletFontSize'] = '8'
for li in ul.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'
content = ul.replace_with(indent)
indent.append(content)
# 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'

Binary file not shown.