Add basic markdown support site wide

This commit is contained in:
Tom Price
2016-01-07 18:14:10 +00:00
parent aa76c6c775
commit b80c38756f
9 changed files with 30 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
{% load markdown_tags %}
{% block title %}{% if object.is_rig %}N{{ object.pk|stringformat:"05d" }}{% else %}{{ object.pk }}{% endif %} | {{object.name}}{% endblock %}
{% block content %}
@@ -141,7 +142,7 @@
<dd>&nbsp;</dd>
<dt>Event Description</dt>
<dd>{{ event.description|linebreaksbr }}</dd>
<dd>{{ event.description|markdown }}</dd>
<dd>&nbsp;</dd>
@@ -205,7 +206,7 @@
<div class="panel-body">
<div class="well well-sm">
<h4>Notes</h4>
{{ event.notes|linebreaksbr }}
{{ event.notes|markdown }}
</div>
{% include 'RIGS/item_table.html' %}
</div>

View File

@@ -1,3 +1,5 @@
{% load markdown_tags %}
<div class="table-responsive">
<table class="table">
<thead>
@@ -51,7 +53,7 @@
{% endif %}
{% if not event.cancelled and event.description %}
<div>
{{ event.description|linebreaksbr }}
{{ event.description|markdown }}
</div>
{% endif %}
</td>
@@ -99,4 +101,4 @@
{% endfor %}
</tbody>
</table>
</div>
</div>

View File

@@ -1,9 +1,10 @@
{% load markdown_tags %}
<tr id="item-{{item.pk}}" data-pk="{{item.pk}}" class="item_row">
<td>
<span class="name">{{ item.name }}</span>
<div class="item-description">
<em class="description">{{item.description|linebreaksbr}}</em>
<em class="description">{{item.description|markdown}}</em>
</div>
</td>
<td>£&nbsp;<span class="cost">{{item.cost|floatformat:2}}</span></td>

View File

@@ -1,5 +1,6 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
{% load widget_tweaks %}
{% load markdown_tags %}
{% block title %}Organisation | {{ object.name }}{% endblock %}
@@ -35,7 +36,7 @@
<dd>{{ object.address|linebreaksbr }}</dd>
<dt>Notes</dt>
<dd>{{ object.notes|linebreaksbr }}</dd>
<dd>{{ object.notes|markdown }}</dd>
<dt>Union Account</dt>
<dd>{{ object.union_account|yesno|capfirst }}</dd>
@@ -108,4 +109,4 @@
</div>
</div>
{% endblock %}
{% endif %}
{% endif %}

View File

@@ -1,5 +1,6 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
{% load widget_tweaks %}
{% load markdown_tags %}
{% block title %}Person | {{ object.name }}{% endblock %}
@@ -35,7 +36,7 @@
<dd>{{ object.address|linebreaksbr }}</dd>
<dt>Notes</dt>
<dd>{{ object.notes|linebreaksbr }}</dd>
<dd>{{ object.notes|markdown }}</dd>
</dl>
</div>
</div>
@@ -105,4 +106,4 @@
</div>
</div>
{% endblock %}
{% endif %}
{% endif %}

View File

@@ -1,5 +1,6 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
{% load widget_tweaks %}
{% load markdown_tags %}
{% block title %}Venue | {{ object.name }}{% endblock %}
@@ -35,7 +36,7 @@
<dd>{{ object.address|linebreaksbr }}</dd>
<dt>Notes</dt>
<dd>{{ object.notes|linebreaksbr }}</dd>
<dd>{{ object.notes|markdown }}</dd>
<dt>Three Phase Available</dt>
<dd>{{ object.three_phase_available|yesno|capfirst }}</dd>
@@ -95,4 +96,4 @@
</div>
</div>
{% endblock %}
{% endif %}
{% endif %}

View File

@@ -0,0 +1,11 @@
from django import template
from django.utils.safestring import mark_safe
import markdown
__author__ = 'ghost'
register = template.Library()
@register.filter(name="markdown")
def markdown_filter(text):
return mark_safe(markdown.markdown(text))

Binary file not shown.

View File

@@ -11,6 +11,7 @@ django-widget-tweaks==1.3
gunicorn==19.3.0
icalendar==3.9.0
lxml==3.4.4
Markdown==2.6.5
Pillow==2.8.1
psycopg2==2.6
Pygments==2.0.2