From 159b6dc746e9f0a84782854f66ec51660cb755a0 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 3 Mar 2012 10:53:12 +0100 Subject: [PATCH] newlines in srt are explicit, fixes #634 --- pandora/item/models.py | 2 +- pandora/user/views.py | 3 ++- static/js/pandora/importAnnotations.js | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 024c71af..311b7c68 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1260,7 +1260,7 @@ class Item(models.Model): return ox.srt.encode([{ 'in': a.start, 'out': a.end, - 'value': a.value + 'value': a.value.replace('
', '
').replace('
\n', '\n').replace('
', '\n') } for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')]) def delete_item(sender, **kwargs): diff --git a/pandora/user/views.py b/pandora/user/views.py index 6fc501ab..17c6c22a 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -644,7 +644,8 @@ def contact(request): 'footer': settings.CONFIG['site']['email']['footer'], 'url': request.build_absolute_uri('/'), }) - message = template.render(context) + subject = ox.decodeHtml(subject) + message = ox.decodeHtml(template.render(context)) response = json_response(text='message sent') try: send_mail(u'%s Contact - %s' % (settings.SITENAME, subject), message, email_from, email_to) diff --git a/static/js/pandora/importAnnotations.js b/static/js/pandora/importAnnotations.js index 5b0ec9fb..888bccc8 100644 --- a/static/js/pandora/importAnnotations.js +++ b/static/js/pandora/importAnnotations.js @@ -60,7 +60,10 @@ pandora.ui.importAnnotations = function(data) { function addAnnotation() { if(srt.length>0) { var data = srt.shift(); - data.text = Ox.parseHTML(data.text); + data.text = Ox.parseHTML(data.text) + .replace(/\n/g, '\n') + .replace(/\n\n/g, '
\n') + .replace(/\n/g, '
\n'); $status.html(Ox.formatDuration(data['in']) + ' to ' + Ox.formatDuration(data.out) + '
\n' + data.text);