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" %}
|
{% extends "base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n markdown %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
{# Précisions sur les modalités de vote #}
|
{# Précisions sur les modalités de vote #}
|
||||||
{% if election.vote_restrictions %}
|
{% if election.vote_restrictions %}
|
||||||
<div class="message is-warning">
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
{# Description de l'élection #}
|
{# Description de l'élection #}
|
||||||
{% if election.description %}
|
{% if election.description %}
|
||||||
<div class="message is-primary">
|
<div class="message is-primary">
|
||||||
<div class="message-body">{{ election.description|linebreaksbr }}</div>
|
<div class="message-body">{{ election.description|markdown|safe }}</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n markdown %}
|
||||||
|
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
|
@ -169,14 +169,14 @@
|
||||||
{# Description de l'élection #}
|
{# Description de l'élection #}
|
||||||
{% if election.description %}
|
{% if election.description %}
|
||||||
<div class="message is-primary">
|
<div class="message is-primary">
|
||||||
<div class="message-body">{{ election.description|linebreaksbr }}</div>
|
<div class="message-body content">{{ election.description|markdown|safe }}</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Précisions sur les modalités de vote #}
|
{# Précisions sur les modalités de vote #}
|
||||||
{% if election.vote_restrictions %}
|
{% if election.vote_restrictions %}
|
||||||
<div class="message is-warning">
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n markdown %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -80,9 +80,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="panel-block">
|
<div class="panel-block">
|
||||||
{{ e.description|linebreaksbr }}
|
<div class="content is-flex-grow-1">
|
||||||
</p>
|
{{ e.description|markdown|safe }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n markdown %}
|
||||||
|
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
{# Précisions sur les modalités de vote #}
|
{# Précisions sur les modalités de vote #}
|
||||||
{% if election.vote_restrictions %}
|
{% if election.vote_restrictions %}
|
||||||
<div class="message is-warning">
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
django==3.2.*
|
django==3.2.*
|
||||||
django-translated-fields==0.11.1
|
django-translated-fields==0.11.1
|
||||||
authens>=0.1b2
|
authens>=0.1b2
|
||||||
|
markdown
|
||||||
numpy
|
numpy
|
||||||
networkx
|
networkx
|
||||||
python-csv
|
python-csv
|
||||||
|
|
|
@ -10589,4 +10589,11 @@ body {
|
||||||
white-space: unset;
|
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 */
|
/*# sourceMappingURL=main.css.map */
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -36,3 +36,13 @@ body
|
||||||
height: auto
|
height: auto
|
||||||
min-height: 2em
|
min-height: 2em
|
||||||
white-space: unset
|
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