Add markdown support
This commit is contained in:
parent
1f3820b3fa
commit
4e756ae800
9 changed files with 43 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n markdown %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -101,7 +101,7 @@
|
|||
{# Précisions sur les modalités de vote #}
|
||||
{% if election.vote_restrictions %}
|
||||
<div class="message is-warning">
|
||||
<div class="message-body">{{ election.vote_restrictions|linebreaksbr }}</div>
|
||||
<div class="message-body content">{{ election.vote_restrictions|markdown|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -171,7 +171,7 @@
|
|||
{# Description de l'élection #}
|
||||
{% if election.description %}
|
||||
<div class="message is-primary">
|
||||
<div class="message-body">{{ election.description|linebreaksbr }}</div>
|
||||
<div class="message-body">{{ election.description|markdown|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n markdown %}
|
||||
|
||||
|
||||
{% block extra_head %}
|
||||
|
@ -169,14 +169,14 @@
|
|||
{# Description de l'élection #}
|
||||
{% if election.description %}
|
||||
<div class="message is-primary">
|
||||
<div class="message-body">{{ election.description|linebreaksbr }}</div>
|
||||
<div class="message-body content">{{ election.description|markdown|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Précisions sur les modalités de vote #}
|
||||
{% if election.vote_restrictions %}
|
||||
<div class="message is-warning">
|
||||
<div class="message-body">{{ election.vote_restrictions|linebreaksbr }}</div>
|
||||
<div class="message-body content">{{ election.vote_restrictions|markdown|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n markdown %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -80,9 +80,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<p class="panel-block">
|
||||
{{ e.description|linebreaksbr }}
|
||||
</p>
|
||||
<div class="panel-block">
|
||||
<div class="content is-flex-grow-1">
|
||||
{{ e.description|markdown|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n markdown %}
|
||||
|
||||
|
||||
{% block extra_head %}
|
||||
|
@ -53,7 +53,7 @@
|
|||
{# Précisions sur les modalités de vote #}
|
||||
{% if election.vote_restrictions %}
|
||||
<div class="message is-warning">
|
||||
<div class="message-body">{{ election.vote_restrictions|linebreaksbr }}</div>
|
||||
<div class="message-body content">{{ election.vote_restrictions|markdown|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
django==3.2.*
|
||||
django-translated-fields==0.11.1
|
||||
authens>=0.1b2
|
||||
markdown
|
||||
numpy
|
||||
networkx
|
||||
python-csv
|
||||
|
|
|
@ -10589,4 +10589,11 @@ body {
|
|||
white-space: unset;
|
||||
}
|
||||
|
||||
.message.is-primary .message-body hr {
|
||||
background-color: #1d273a;
|
||||
}
|
||||
.message.is-warning .message-body hr {
|
||||
background-color: #ffdd57;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=main.css.map */
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -36,3 +36,13 @@ body
|
|||
height: auto
|
||||
min-height: 2em
|
||||
white-space: unset
|
||||
|
||||
.message
|
||||
&.is-primary
|
||||
.message-body
|
||||
hr
|
||||
background-color: $primary
|
||||
&.is-warning
|
||||
.message-body
|
||||
hr
|
||||
background-color: $warning
|
||||
|
|
10
shared/templatetags/markdown.py
Normal file
10
shared/templatetags/markdown.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
import markdown
|
||||
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter(name="markdown")
|
||||
def markdownify(text):
|
||||
return markdown.markdown(text, extensions=["extra"])
|
Loading…
Reference in a new issue