Commit 54315adf authored by Nicolas G.'s avatar Nicolas G.

Traitement des caractères spéciaux dans le fichier iCal.

parent 9091102e
{% load html %}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Firstjeudy//FR
......@@ -5,7 +6,7 @@ BEGIN:VEVENT
DTSTART:{{ jour }}T{{ ville.debut|time:"His" }}
DTEND:{{ jour }}T{{ ville.fin|time:"His" }}
SUMMARY:{{ ville.nom }}
DESCRIPTION:{{ ville.message|striptags }}
DESCRIPTION:{{ ville.message|striptags|htmlentitydecode }}
URL: {{ url }}
LOCATION:{{ ville.lieu }}
BEGIN:VALARM
......
# Copyright (C) 2018 Nicolas Grandjean <nicolas@microniko.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django import template
register = template.Library()
import html
@register.filter( name='htmlentitydecode')
def htmlentitydecode(value):
""" Nouveau tag permettant de convertir les caractères spéciaux
HTML en leur équivalent Unicode
Usage : {{ str|htmlentitydecode }}
"""
return html.unescape(value)
htmlentitydecode.is_safe = True
{% load html %}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Firstjeudy/ponctu//FR
......@@ -5,7 +6,7 @@ BEGIN:VEVENT
DTSTART:{{ debut|date:"Ymd" }}T{{ debut|time:"His" }}
DTEND:{{ fin|date:"Ymd" }}T{{ fin|time:"His" }}
SUMMARY:{{ rencontre.nom }}
DESCRIPTION:{{ rencontre.message|striptags }}
DESCRIPTION:{{ rencontre.message|striptags|htmlentitydecode }}
URL: {{ url }}
LOCATION:{{ rencontre.lieu }}
BEGIN:VALARM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment