diff options
-rw-r--r-- | docs/index.txt | 2 | ||||
-rw-r--r-- | tempita/__init__.py | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/docs/index.txt b/docs/index.txt index a9b6814..44d412d 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -480,6 +480,8 @@ svn trunk rules, and must be a module name) the template name is put into ``__template_name__``. This became important in Python 2.5. +* Fix some issues with \r + 0.3 --- 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( |