Permalink
Browse files

Merge branch 'tmpl_newline_escaping'

  • Loading branch information...
2 parents c9acf49 + dc88e36 commit 8aa67571d2bae6f9f59fbcd0ce3a29a3e784ef11 @tsufeki committed Jul 18, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 qygmy/templates/template.py
@@ -59,11 +59,14 @@ def parse_first(cls, src, pos=0):
class Backslash(RegexElement):
- regex = re.compile(r'\\(.)')
+ newlines = ('\n', '\r\n', '\r')
+ regex = re.compile(r'\\({}|.)'.format('|'.join(newlines)))
def __init__(self, src, start, end, char):
super().__init__(src, start, end)
self.char = char
+ if char in self.newlines:
+ self.char = ''
def render(self, context):
return self.char

0 comments on commit 8aa6757

Please sign in to comment.