Wrapping the templates macros into blocks?

11 views
Skip to first unread message

basi...@gmail.com

unread,
Apr 21, 2013, 3:03:18 PM4/21/13
to tinker...@googlegroups.com
Hi guys, 

I was wondering if you consider a small feature of wrapping all the boilerplate templates' macros into blocks (a block per macro), so that it would be possible to override them in user themes. 

I would love to implement this (I never participated in fork->implement->pull request workflow before!), and consider it worth the time (Vlad, hopefully your time as well :) 

What do you think?

Vlad Riscutia

unread,
Apr 22, 2013, 3:14:44 PM4/22/13
to tinker...@googlegroups.com
I am not sure Jinja2 allows that. I tried wrapping a macro in a block and Jinja compiler failed when macro was called saying it cannot find it. Are you sure this is possible to implement?

Thank you,
Vlad


--
You received this message because you are subscribed to the Google Groups "tinkerer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinkerer-dev...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Zaur Nasibov

unread,
Apr 23, 2013, 2:49:28 PM4/23/13
to tinker...@googlegroups.com
Just checked, you were right Vlad.

So pity :( Hm, maybe I can contact Armin Ronacher to see his opinion on this functionality :)

Zaur
You received this message because you are subscribed to a topic in the Google Groups "tinkerer-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tinkerer-dev/3UW9g0erf9A/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to tinkerer-dev...@googlegroups.com.

Vlad Riscutia

unread,
Apr 23, 2013, 3:53:23 PM4/23/13
to tinker...@googlegroups.com
Yeah, though I'm not too upset about it. I think most sections where these macros are called are placed in blocks, so people can just create new macros and re-implement the calling blocks.

Thank you,
Vlad

Zaur Nasibov

unread,
Apr 24, 2013, 8:56:22 AM4/24/13
to tinker...@googlegroups.com
How about adding in-macro block wrappers? Something like:

{%- macro post_meta(metadata, comment_count_code=None) -%}
    {%- block post_meta_macro_block -%}
        <div class="postmeta">
        ...   
        </div>
    {%- endblock -%}
{%- endmacro -%}

?

Vlad Riscutia

unread,
Apr 24, 2013, 1:30:32 PM4/24/13
to tinker...@googlegroups.com
I don't think the added complexity is worth it really. There are just a few macros and a theme that wants to use something different instead can easily do so.

Thank you,
Vlad
Reply all
Reply to author
Forward
0 new messages