diff options
Diffstat (limited to 'tempita/__init__.py')
-rw-r--r-- | tempita/__init__.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tempita/__init__.py b/tempita/__init__.py index b15031d..dfb2f91 100644 --- a/tempita/__init__.py +++ b/tempita/__init__.py @@ -770,8 +770,12 @@ def parse_expr(tokens, name, context=()): expr = expr.strip() if expr.startswith('py:'): expr = expr[3:].lstrip(' \t') - if expr.startswith('\n'): - expr = expr[1:] + if expr.startswith('\n') or expr.startswith('\r'): + expr = expr.lstrip('\r\n') + if '\r' in expr: + expr = expr.replace('\r\n', '\n') + expr = expr.replace('\r', '') + expr += '\n' else: if '\n' in expr: raise TemplateError( |