diff --git a/get_together/templates/get_together/events/share_event.html b/get_together/templates/get_together/events/share_event.html index 89f8e3c..a05e189 100644 --- a/get_together/templates/get_together/events/share_event.html +++ b/get_together/templates/get_together/events/share_event.html @@ -1,5 +1,5 @@ {% extends "get_together/base.html" %} -{% load static %} +{% load markup static %} {% block add_to_totle %} | {{event.name}}{% endblock %} @@ -7,7 +7,7 @@ - + {% endblock %} @@ -37,7 +37,7 @@ display: 'popup', method: 'share', href: '{{event.get_full_url}}', - quote: 'I\'m having a Get Together!\n\n{{event.summary}}', + quote: 'I\'m having a Get Together!\n\n{{event.name|jsencode}}', hashtag: '#gettogether', summary: "Let's have a Get Together!" }, function(response){}); @@ -71,7 +71,7 @@ {% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}Facebook{% endif %} {% if settings.SOCIAL_AUTH_TWITTER_KEY %} Twitter {% endif %} diff --git a/get_together/templatetags/markup.py b/get_together/templatetags/markup.py index 6feca71..684735d 100644 --- a/get_together/templatetags/markup.py +++ b/get_together/templatetags/markup.py @@ -43,3 +43,8 @@ def markdown(value, arg=''): """ return mark_safe(md.markdown(value)) +@register.filter +@stringfilter +def jsencode(value, arg=''): + value = value.replace("\n", "\\n").replace('"', '\"').replace("'", "\'") + return mark_safe(value)