]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
templatetags: fix syntax display of CRLF's
authorAndy Doan <andy.doan@linaro.org>
Tue, 16 Feb 2016 21:20:00 +0000 (15:20 -0600)
committerStephen Finucane <stephen.finucane@intel.com>
Wed, 17 Feb 2016 21:18:11 +0000 (21:18 +0000)
Patches that include CRLF's include extra lines in the UI. Rather than
each patch line being:

 <span ...>content</span>

Its source will be:
 <span ...>content
 </span>

Signed-off-by: Andy Doan <andy.doan@linaro.org>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/templatetags/syntax.py

index 1f7e718156814bf7d3cffd2931ec74ccd6e8f9cd..2a4164d6e9b244587bc09d13ca223f8479626593 100644 (file)
@@ -59,7 +59,7 @@ _span = '<span class="%s">%s</span>'
 
 @register.filter
 def patchsyntax(patch):
-    content = escape(patch.content)
+    content = escape(patch.content).replace('\r\n', '\n')
 
     for (r, cls) in _patch_span_res:
         content = r.sub(lambda x: _span % (cls, x.group(0)), content)