From 864e71817e58687478ad5a7c7989c08db4df8745 Mon Sep 17 00:00:00 2001 From: WoLpH Date: Tue, 19 Nov 2013 19:12:01 +0100 Subject: [PATCH] Support for the kind in the endblock Example: {% block css %} ... some other stuff {% endblock css %} Instead of (both are supported): {% block css %} ... some other stuff {% endblock %} --- compressor/contrib/jinja2ext.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compressor/contrib/jinja2ext.py b/compressor/contrib/jinja2ext.py index 6c2f792..d7d84d9 100644 --- a/compressor/contrib/jinja2ext.py +++ b/compressor/contrib/jinja2ext.py @@ -29,6 +29,10 @@ class CompressorExtension(CompressorMixin, Extension): else: args.append(nodes.Const('file')) body = parser.parse_statements(['name:endcompress'], drop_needle=True) + + # Skip the kind if used in the endblock, by using the kind in the + # endblock the templates are slightly more readable. + parser.stream.skip_if('name:' + kindarg.value) return nodes.CallBlock(self.call_method('_compress', args), [], [], body).set_lineno(lineno)