You can achieve that by registering a template engine for HAML.
You can freely extend TG with custom template engines, there are a bunch of
example around.

tgext.odt is a quite simple example that register a template engine to
render OpenOffice documents:
https://github.com/puria/tgext.odt/blob/master/tgextodt/__init__.py#L41


2014-01-24 Yajo <[email protected]>

> El martes, 17 de diciembre de 2013 14:44:33 UTC+1, Moritz Schlarb escribió:
>
>> Hi there,
>>
>> > I'm interested in using TurboGears 2, but I cannot see any help on
>> using
>> > any implementation of HAML (preferrably hamlpy or hamlish_jinja), which
>> > is something I can't live without.
>> Well, I think the reason there is no documentation on that is simply
>> that nobody had this requirement up to now.
>>
>> I would assume that using hamlish_jinja would be easier, since plain
>> jinja is already supported by TurboGears, so you just have to figure a
>> way to enable the extension.
>> As I always say: Use the source, luke:
>> https://github.com/TurboGears/tg2/blob/master/tg/
>> configuration/app_config.py#L627
>>
>> So it should be sufficient to set base_config.jinja_extensions =
>> [HamlishExtension] in your app_cfg.py.
>>
>
> Thank you very much. This is the first approach I used, and I really love
> hamlish_jinja.
>
> The problem is that it makes Jinja to render *.haml files using
> HamlishExtension, and render any other files using plain Jinja. However, I
> can't find how to tell TurboGears that *.haml templates should be rendered
> with Jinja. How can I?
>
> As a workaround I used HamlishTagExtension and *.jinja files with haml
> code between {% haml %} and {% endhaml %}, in case it helps. However, the
> first approach would be much better.
>
> > Note to moderators: it's about the 5th time I ask this. If you consider
>> > this comment to be spam, please tell me why, because I see no problem
>> on
>> > it. Thanks.
>>
>> Well if that's the case, your message never made it through before, this
>> is the first time, I see something about HAML.
>> How did you ask before?
>>
>
> I always used the google groups interface. I also recieved no notification
> of your responses (that's why I am answering 1 month later). Weird.
>
> However it's working now. Thanks for publishing anyway!
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to