Open octplane opened 11 years ago
Hey, I think that's a great feature to have! My daughter graduates, this weekend, so we have filled our days with graduation and college orientation activities. If I complete the feature by the end of June, would that fulfill your needs and timeline?
Hello,
Thanks for your quick reply. I'd be glad to wait a bit until this is implemented. I've also found out that I'm using the haml
method in my haml views. Maybe implementing something like in template.FuncMap
would be cool.
I've had a small look at the code and extending the parser seems to be quite rather complex. Maybe you can direct me in the right direction and I'll try to work on this.
In the meantime, I've tried mixing your library with html/template
and it seems to work quite well. Maybe this could be a solution to avoid having to implement lots of rubyism in gohaml...
Cheers and happy graduation :)
If you don't mind, would you send an example of the hybrid html/template+gohaml code? I'd like to see the way you so it and include the knowledge in the readme!
This looks more or less like that: https://github.com/octplane/uu-g/blob/master/views/index.haml.template
However, as I'm trying to rewrite the "layout" behavior of some well known frameworks (sinatra in my case), I'm struggling to make Haml and Template play nicely.
Currently, I'm parsing the template, applying with the scope and then Hamling the result. However, in order to have support for a simple "layout like behavior", I then need to inject another transformed template in the layout. And this breaks because of some ugly stuff regarding haml indentation.
So the html.Template + Haml works for simple cases, but for more advanced output, I will have to find a way to add some logic in haml...
To be continued...
I seem to have been running into a number of simliar issues (but have been too busy to elaborate until now...)
implemented these
realized a bunch of features aren't supported for haml, implemented the haml-spec tests (added in branch spec_test
which I haven't merged, because hardly any of the specs pass)
I realized this would be way too much, especially if all the rubyisms need to be supported. My attempts at fixes are in the (spec_attempt_fix
) branch.
I ended up frustrated and rewrote precisely the subset of haml that I need (https://github.com/a2800276/gaml) because I didn't understand the implementation (I assume my implementation is WAY more confusing, but at least I wrote it and I know what's going on and MY specific needs are met)
I also decided to follow the haml + Go templates route (example: https://github.com/a2800276/gaml/blob/master/example/template.go)
Sorry, I'm aware this doesn't really solve any problems, but I did want to: a.) provide the specs tests and b.) some of the partial solutions for the uncovered problems, even if I won't be finishing them all myself.
I've just about got to the point where I can dedicate some time to working on v2 of gohaml. This will have much better extensibility and will pass haml-spec tests, as well. Just FYI.
Hello,
Playing with your nice library to port some code from sinatra to go. I would like to know if implementing the support for if / else would be too much asking :)
Thank you for this library ! Pierre.