Allow newlines inside {% %} tags

It doesn’t need to be part-way through. Like Python’s __future__ rules, we can require that the special tag appears near the top of the file.

The change here is in tokenization, which is technically the step before parsing.

The warning needs only be done once when loading the template. After tokenizing, when the old mode is in effect, we could check all text nodes for {%, {{, or {#, and warn for each occurrence. I would expect this to be a small cost compared to the existing tokenization run.

The “templates are slow” statement/meme normally refers to render time, not load/parsing time, as far as I’ve heard. So, I don’t think such a check would impact the main cost.

(I have an open proposal to help optimize render time a bit: Add __slots__ to template Node classes (only) .)