tyler-sommer / stick

A golang port of the Twig templating engine
MIT License
183 stars 36 forks source link

Unable to use set tag to capture chunks of text #42

Closed thatDAMNbobby closed 1 year ago

thatDAMNbobby commented 3 years ago

I'd like to use this format of the set tag, but it doesn't appear to be implemented (results in a parse error)

{% set foo %}
    <div id="pagination">
        ...
    </div>
{% endset %}

Any plans to implement this in the future?

tyler-sommer commented 3 years ago

@thatDAMNbobby Good catch! I didn't realize this syntax was possible. I'm definitely interested in implementing this, but may not be able to devote any time to it in the near future.

Vizualni commented 2 years ago

I am getting the same error as well

eriknyk commented 2 years ago

@thatDAMNbobby @thatDAMNbobby @Vizualni do you know that twig is a clone of python django template engine, and that there is already a golang template engine that already support django like template engine? https://www.schlachter.tech/solutions/pongo2-template-engine/ it have more community and looks have more supported currently, since last commit is about 1 month ago. (I'm not work on it I just found it by coincidence.)

Regards.

tyler-sommer commented 2 years ago

https://www.schlachter.tech/solutions/pongo2-template-engine/

pongo2 looks great! I've updated the README with a link to that project as I think it's worth calling out as an alternative to stick. Thanks for pointing this out, @eriknyk!

tyler-sommer commented 1 year ago

Finally had a bit of time to devote to this, and I'm happy to report that this has been fixed in 22492ee95657618e1b467d6e3830cda4d3ae4dd2 and is available in v1.0.6 and later.

Thanks again for the feedback @thatDAMNbobby :)