Enable whitespace control within closing blocks

This enables the ability to force whitespace to be stripped following
the end of a block statement by adding a `-` before the closing
tag. This is supported both for stripped the space at the beginning
of a block as well as stripping the space that follows a block.
This commit is contained in:
Kevin Brown 2020-05-08 19:55:24 -04:00 committed by Kevin
parent 060a6f301f
commit 41c23c37cc
2 changed files with 8 additions and 6 deletions

View File

@ -29,12 +29,12 @@ raw_block_expression
raw_block_start
=
block_open "raw" block_close
block_open "raw" {SP}* block_close
;
raw_block_end
=
block_open "endraw" block_close
block_open "endraw" {SP}* block_close
;
block_expression
@ -50,16 +50,18 @@ block_start
block_end
=
block_open "end" name:IDENTIFIER block_close
block_open "end" name:IDENTIFIER {SP}* block_close
;
block_open
=
@:"{%" {SP}*
;
block_close
=
{SP}* @:"%}"
| @:"%}"
| ( @:"-%}" {SP}* )
;
line_block_expression

View File

@ -31,10 +31,10 @@ across lines #}
The value will increase even more!
{% endif %}
{% endfor %}
{% macro textarea(name, value='', rows=10, cols=40) %}
{% macro textarea(name, value='', rows=10, cols=40) -%}
<textarea name="{{ name }}" rows="{{ rows }}" cols="{{ cols
}}">{{ value|e }}</textarea>
{% endmacro %}
{% endmacro -%}
{# comment contents
across lines #}
<ul>