[PATCH] templatetags: fix syntax display of CRLF's
Andy Doan
andy.doan at linaro.org
Wed Feb 17 08:20:00 AEDT 2016
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 at linaro.org>
---
patchwork/templatetags/syntax.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/patchwork/templatetags/syntax.py b/patchwork/templatetags/syntax.py
index 1f7e718..2a4164d 100644
--- a/patchwork/templatetags/syntax.py
+++ b/patchwork/templatetags/syntax.py
@@ -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)
--
2.5.0
More information about the Patchwork
mailing list