Typonazisme

This commit is contained in:
Evarin 2017-06-30 19:26:05 +02:00
parent 91d2408170
commit 686999b97d
2 changed files with 16 additions and 5 deletions

View file

@ -1,9 +1,9 @@
{% load avisstage_tags %}
<section class="avis">
<h2>{{ titre }}</h2>
{% if avis.chapo %}
<p class="chapo">
{{ avis.chapo|linebreaksbr }}
{{ avis.chapo|typonazisme|linebreaksbr }}
</p>
{% endif %}
{% for av in avis.avis_all %}
@ -11,7 +11,7 @@
<div class="avis-item">
<h3>{{ av.0 }}</h3>
<div class="avis-texte">
{{ av.1|safe }}
{{ av.1|typonazisme|safe }}
</div>
</div>
{% endif %}
@ -21,7 +21,7 @@
<div class="plus">
<div>
<h4>Super si vous aimez...</h4>
<p>{{ avis.les_plus|linebreaksbr }}</p>
<p>{{ avis.les_plus|typonazisme|linebreaksbr }}</p>
</div>
</div>
{% endif %}
@ -29,7 +29,7 @@
<div class="moins">
<div>
<h4>Pas génial pour...</h4>
<p>{{ avis.les_moins|linebreaksbr }}</p>
<p>{{ avis.les_moins|typonazisme|linebreaksbr }}</p>
</div>
</div>
{% endif %}

View file

@ -1,6 +1,8 @@
# coding: utf-8
from django import template
from avisstage.forms import LieuForm, FeedbackForm
import re
register = template.Library()
@ -13,3 +15,12 @@ def lieu_widget():
def feedback_widget():
form = FeedbackForm()
return {"form": form}
@register.filter
def typonazisme(value):
print value
#return value
value = re.sub(r'(\w)\s*([?!:])', u'\\1\\2', value)
value = re.sub(r'(\w)\s*([,.])', u'\\1\\2 ', value)
value = re.sub(r'([?!:,.])(\w)', u'\\1 \\2', value)
return value