summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2017-02-19 18:14:50 +0100
committerJelle van der Waa <jelle@vdwaa.nl>2018-04-08 12:51:19 +0200
commitc7681318b709dc3d61d16999ba1865c622dd390d (patch)
tree06851d54389bd9b8d13f5436342472aaf5704d3b /main
parentdfb7be585f561deed0819c4a957460200f441534 (diff)
downloadarchweb-c7681318b709dc3d61d16999ba1865c622dd390d.tar.gz
archweb-c7681318b709dc3d61d16999ba1865c622dd390d.zip
templatetags: use render_html for rendering html tags
Diffstat (limited to 'main')
-rw-r--r--main/templatetags/cdn.py3
-rw-r--r--main/templatetags/flags.py5
-rw-r--r--main/templatetags/pgp.py4
3 files changed, 7 insertions, 5 deletions
diff --git a/main/templatetags/cdn.py b/main/templatetags/cdn.py
index e0b702be..3116cce0 100644
--- a/main/templatetags/cdn.py
+++ b/main/templatetags/cdn.py
@@ -1,5 +1,6 @@
from django import template
from django.contrib.staticfiles.storage import staticfiles_storage
+from django.utils.html import format_html
register = template.Library()
@@ -17,6 +18,6 @@ def jquery_tablesorter():
version = '2.7'
filename = 'jquery.tablesorter-%s.min.js' % version
link = staticfiles_storage.url(filename)
- return '<script type="text/javascript" src="%s"></script>' % link
+ return format_html('<script type="text/javascript" src="%s"></script>' % link)
# vim: set ts=4 sw=4 et:
diff --git a/main/templatetags/flags.py b/main/templatetags/flags.py
index 3abd1aed..fafcb5aa 100644
--- a/main/templatetags/flags.py
+++ b/main/templatetags/flags.py
@@ -1,4 +1,5 @@
from django import template
+from django.utils.html import format_html
register = template.Library()
@@ -7,8 +8,8 @@ register = template.Library()
def country_flag(country):
if not country:
return ''
- return '<span class="fam-flag fam-flag-%s" title="%s"></span> ' % (
- unicode(country.code).lower(), unicode(country.name))
+ return format_html('<span class="fam-flag fam-flag-%s" title="%s"></span> ' % (
+ unicode(country.code).lower(), unicode(country.name)))
# vim: set ts=4 sw=4 et:
diff --git a/main/templatetags/pgp.py b/main/templatetags/pgp.py
index f5b937b6..ad4e49d0 100644
--- a/main/templatetags/pgp.py
+++ b/main/templatetags/pgp.py
@@ -1,6 +1,6 @@
from django import template
from django.conf import settings
-from django.utils.html import conditional_escape
+from django.utils.html import conditional_escape, format_html
from django.utils.safestring import mark_safe
@@ -41,7 +41,7 @@ def pgp_key_link(key_id, link_text=None):
if link_text is None:
link_text = '0x%s' % key_id[-8:]
values = (url, format_key(key_id), link_text)
- return '<a href="%s" title="PGP key search for %s">%s</a>' % values
+ return format_html('<a href="%s" title="PGP key search for %s">%s</a>' % values)
@register.simple_tag