Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Line statements eat newlines #52

gavento opened this Issue · 3 comments

2 participants


Line statements eat not only the spaces until the beginning of the line as documented at , but also all the previous newlines.

As of 2.7-dev, the following code generates no empty lines:

%% for i in range(3)
{{i}}, next line should be empty

%% endfor

This is an issue in languages where newlines matter (generated LaTeX).


Can be fixed in by changing the regex from r'^\s*' to r'^[ \t\v]*'. This makes the whitespace list limited, but that should not be an issue without re.UNICODE or re.LOCALE


Hmm. There still needs to be a way of including blank lines in the code which do not get rendered in the output, but are only there for legibility. I propose that lines containing line_statement_prefix (or line_comment_prefix) and nothing else be the mechanism for this. Currently they are not handled in a helpful way (filed as #204 and #205).


Just discovered that {##} is a tolerable workaround.

@mitsuhiko mitsuhiko closed this in 08f38a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.