Closed ronan-gloo closed 11 years ago
Awesome!
I'll take a closer look at your PRs as soon as possible.
Looks really good, nice work! What's the use case for multiple saved indentations ?
I'm not sure to get the case. Can you provide an example, please ?
Nice work!
There is one thing we have to care about: The interface should allow to implement every possible filter (e.g. all these filters). It seems that we are missing a method taking the raw markup and returning the filtered markup, at runtime (so that #{...}
work). We should try to implement some of them before merging this (e.g. the escaped
filter).
I would prefer if enter/leave took the renderer as parameter. This would make filters reentrant.
We could create a FilterProvider class with an interface like this:
function getFilter($name) -> FilterInterface
And move Filter node 's getFilter logic here.
An other issue is, with the actual filter's instantiation process, is we can't instantiate a filter without a renderer. As you suggested, passing the renderer as method parameter allow us to proxy filters instantiations from the Environment, where the renderer is not available as long as we recreate it through the parser. A filter provider class is a good idea in order to care about filters availability / loading process, and inject it in the Environment class.
It looks like that filters' content can have #{ ... code ... }
interpolation: http://haml.info/docs/yardoc/file.REFERENCE.html#filters . This means that for some filters we would need to do the filtering at runtime. For instance the escaped
filter would need that.
Any progress? This functionality is very important for me. Can I help you?
Sorry, i was very busy lasts months, and didn't took time to work on it. I'll try to finish it as soon as possible !
A proposition to add user filters, see #19
As a proposition, i haven't wrote test right now...
Anatomy of a filter class
Filters should at least implements the MtHaml\Filter\FilterInterface. The best way is to extends your filter from MtHaml\Filter\FilterAbstract.
Adding Filters