newlines in srt are explicit, fixes #634

This commit is contained in:
j 2012-03-03 10:53:12 +01:00
parent aefd716615
commit 159b6dc746
3 changed files with 7 additions and 3 deletions

View file

@ -1260,7 +1260,7 @@ class Item(models.Model):
return ox.srt.encode([{ return ox.srt.encode([{
'in': a.start, 'in': a.start,
'out': a.end, 'out': a.end,
'value': a.value 'value': a.value.replace('<br/>', '<br>').replace('<br>\n', '\n').replace('<br>', '\n')
} for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')]) } for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')])
def delete_item(sender, **kwargs): def delete_item(sender, **kwargs):

View file

@ -644,7 +644,8 @@ def contact(request):
'footer': settings.CONFIG['site']['email']['footer'], 'footer': settings.CONFIG['site']['email']['footer'],
'url': request.build_absolute_uri('/'), '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') response = json_response(text='message sent')
try: try:
send_mail(u'%s Contact - %s' % (settings.SITENAME, subject), message, email_from, email_to) send_mail(u'%s Contact - %s' % (settings.SITENAME, subject), message, email_from, email_to)

View file

@ -60,7 +60,10 @@ pandora.ui.importAnnotations = function(data) {
function addAnnotation() { function addAnnotation() {
if(srt.length>0) { if(srt.length>0) {
var data = srt.shift(); var data = srt.shift();
data.text = Ox.parseHTML(data.text); data.text = Ox.parseHTML(data.text)
.replace(/<br[ /]*?>\n/g, '\n')
.replace(/\n\n/g, '<br>\n')
.replace(/\n/g, '<br>\n');
$status.html(Ox.formatDuration(data['in']) $status.html(Ox.formatDuration(data['in'])
+ ' to ' + Ox.formatDuration(data.out) + '<br>\n' + ' to ' + Ox.formatDuration(data.out) + '<br>\n'
+ data.text); + data.text);