defnull/bottle — Issue #285: SimpleTemplate {% blocks %} proposal
Author: iurisilvio
Created: 2012-02-15 16:03:26+00:00
State: open

Today I was thinking about JavaScript compression and how other frameworks handle it. Flask has Assets [1], Django has a lot of compressor plugins [2] [3]. All of them (which I looked) use template blocks, because they are based on django templates or Jinja2.

I know I can do something similar using Python functions to create blocks, but it is not a reusable way to do it. I can do something like `{{ my_filter('some html') }}`, but I can't do it in a pretty way with a multiline html for example.

I'm not proposing a specific syntax yet, first I want to know if other people want this too. It is a big limitation to me and I don't want to use other template engine, I like SimpleTemplate.

I found an old issue about something similar [4], but I already explained why it doesn't solve the problem. I need to define a function and call it just to render some simple HTML, I don't like it.

[1] http://flask-assets.readthedocs.org/en/latest/index.html
[2] http://djangopackages.com/grids/g/asset-managers/
[3] https://github.com/jezdez/django_compressor
[4] https://github.com/defnull/bottle/issues/20