Future topic and feature wishlist
Based on user input I put up a list of topics I'm considering for future pongo2 versions:
- Improvements in whitespace control (example: jinja2)
- Debugging tools (see #159)
- (to be continued)
Feel free to add any ideas and wishes as comments below.
I'd love to see inline extends (like include but with slots)
base.tpl (not relevant but just to make it clear)
<html><body>
{% block body %}{% endblock %}
</body></html>
modal.tpl (a reusable component with three slots)
<section class="modal">
<header>{% block header %}{% endblock %}</header>
<article>{% block body %}{% endblock %}</article>
<footer>{% block footer %}{% endblock %}</footer>
</section>
page_with_modal.tpl:
{% extends "base.tpl" %}
{% block body %}
Hello world!!
<!-- so include also providing a slot mechanism like extends, enabling reusable components -->
{% include "modal.tpl" %}
{% block header %}Modal title{% endblock %}
{% block body %}Lorem ipsum{% endblock %}
{% block footer %}Modal footer{% endblock %}
{% endinclude %}
{% endblock %}
@flosch hi there! after a year, I just wanted to check if you think what I suggested above would be good idea. if so, and you don't have time, maybe I can give it a go?
@egeozcan Is there any existing implementation of this feature in other well-known template engines?
@flosch
In Vue.js and Web Components, this is possible with named slots. In angular, projections are used, and in React, you can pass components as parameters and render them anywhere.
On the server side: Symfony has something similar with named slots. Laravel/Blade also has slots. Django has Slippers, and I was told that Django Components can do something similar but I've never used it.
My use case is, I want to create Alpine.js components on the server side, with injection points.