From a2bd62dd31636b4842e25458e1cbbea3a3052467 Mon Sep 17 00:00:00 2001 From: ianb Date: Tue, 6 Mar 2007 00:43:11 +0000 Subject: Make paste.util.template trim whitespace around statements on their own line --- tests/test_template.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_template.txt b/tests/test_template.txt index 9765011..a56049f 100644 --- a/tests/test_template.txt +++ b/tests/test_template.txt @@ -106,4 +106,13 @@ in Python, but it's more useful in templates generally):: 3 Banana O: 4 orange - \ No newline at end of file + +It will also strip out empty lines, when there is a line that only +contains a directive/statement (if/for, etc):: + + >>> sub('{{if 1}}\n{{x}}\n{{endif}}\n', x=0) + '0\n' + >>> sub('{{if 1}}x={{x}}\n{{endif}}\n', x=1) + 'x=1\n' + >>> sub('{{if 1}}\nx={{x}}\n{{endif}}\n', x=1) + 'x=1\n' -- cgit v1.2.1