X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=tools%2Ftemplatetags%2Fgapless.py;h=ca93a562e8737035f32da7bc83cfd300bede0798;hb=b82030de79f2cde6b3953a4d23d33901cbd9638d;hp=9defba53502b398a78e4cca0993d4808e3d82d41;hpb=d0e331d60ba2c49680a1f012bb8b81e0ea7c3608;p=matthijs%2Fprojects%2Fxerxes.git diff --git a/tools/templatetags/gapless.py b/tools/templatetags/gapless.py index 9defba5..ca93a56 100644 --- a/tools/templatetags/gapless.py +++ b/tools/templatetags/gapless.py @@ -8,7 +8,7 @@ register = Library() def strip_empty_lines(value): """Return the given HTML with empty and all-whitespace lines removed.""" - return re.sub(r'\n[ \t]*(?=\n)', '', force_unicode(value)) + return re.sub(r'(\n[ \t]*|(?<=\n)\\\\)(?=\n)', '', force_unicode(value)) strip_empty_lines = allow_lazy(strip_empty_lines, unicode) class GaplessNode(Node): @@ -43,3 +43,5 @@ def gapless(parser, token): parser.delete_first_token() return GaplessNode(nodelist) gapless = register.tag(gapless) + +# vim: set sw=4 sts=4 expandtab: