I frequently write short snippets of HTML that I want to replicate in many places, like:
<div class="friend_selector"> <div class="access_photos" users="[]"></div> <input id="main_access_input" name="access_input" class="access_input" size="30" type="text" value="" /> </div> So I can put this into a .html file "friend_selector.html", and then include it whenever I need this. But I often need to parameterize it. For instance, I might want to set a different id each time. So I do it like this: {{vars = {id : 'main_access_input'} }} {{include 'friend_selector.html'}} {{vars = {} }} And then parameterize my html like this: <div class="friend_selector"> <div class="access_photos" users="[]"></div> <input {{if vars['id']:}}id="{{=vars['id']}}"{{pass}} name="access_input" class="access_input" size="30" type="text" value="" /> </div> Basically, I'm re-inventing a function call via the {{include}} feature. Wouldn't it be awesome if this just happened automatically??? Like this: {{include 'friend_selector.html' (id='main_access_input')}} Would you like this feature? Does this sound hard to implement? Appendix: 1. You can also do this I think with template inheritance, but that's just complicated. Or you could define and call parameterized functions in python, but editing embedded html in python strings is gross. 2. The (id='main_access_input') part would ideally be a full python- style parameter list, supporting e.g. (a=1, b=3). This is simpler to implement. But to support positional args, like (1,3,5, a=1), the html blocks would need to declare their supported parameters. They could do so with by including a "declare" snippet like this: {{ declare (a, b, c, id=None): }} <div class="friend_selector"> <div class="access_photos" users="[]"></div> <input {{if id:}}id="{{=id}}"{{pass}} name="access_input" class="access_input" size="30" type="text" value="" /> </div>