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

View file

@ -1,6 +1,8 @@
# coding: utf-8
from django import template from django import template
from avisstage.forms import LieuForm, FeedbackForm from avisstage.forms import LieuForm, FeedbackForm
import re
register = template.Library() register = template.Library()
@ -13,3 +15,12 @@ def lieu_widget():
def feedback_widget(): def feedback_widget():
form = FeedbackForm() form = FeedbackForm()
return {"form": form} 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