Pitmairen/hamlish-jinja

haml filter not working

Opened this issue · 2 comments

Hi!!
I'll like to use this extension in one of my project.

But i'll like to know if there is any support for haml filter ( :less, :javascript :coffee and so one and so forth)?

There is no support for filters. This is not a complete implementation of haml, so some features are not implemented and the syntax may be a little bit different.

But having support for some kind of filters could be useful so I may try to add this when I have time. I don't have that much spare time at the moment, so don't hold you breath.

I have added support for user defined filters now:

def my_filter(text):
    #do something to text
    return text

env.hamlish_filters={'my_filter': my_filter}
%html
  %body
    %div
      :my_filter
        content

The filter function will get passed in all content that is defined inside the filter block in the template.
In this example my_filter will get "content" and the returned value will replace the content in the template.