PebbleTemplates / pebble

Java Template Engine
https://pebbletemplates.io
BSD 3-Clause "New" or "Revised" License
1.1k stars 168 forks source link

Embed tag failed when template is in includes #675

Open unaor opened 7 months ago

unaor commented 7 months ago

in my spring app using spring boot started 3.2.2 i have three templates layout.html navbarSubtitle.html list.html

in my layout i do the following:

<div id="app" hx-ext="response-targets" hx-headers='{&quot;{{_csrf.headerName}}&quot;:&quot;{{_csrf.token}}&quot;}'>
        {% include "base/topbar" %}
        {% include "base/navbar" %}
        {% include "base/navbarSubtitle" %}
        <!-- {% include "base/widgetContainer" %} -->
        <section id="content" class="section is-main-section">
            <!-- {% include "base/graph" %}
            {% include "base/table" %} -->
            {% block content %}{% endblock %}
            {% include "base/footer" %}

        </section>

    </div>

and in my navbarSubtitle I do like this:

 <section class="section is-title-bar">
    <div class="level">
      <div class="level-left">
        <div class="level-item">
          <ul>
            <li>Cybernac</li>
            <li>{% block navbarSubtitle %}Test{% endblock %}</li>
          </ul>
        </div>
      </div>
      <div class="level-right">
        <div class="level-item">
          <div class="buttons is-right">
            <a href="https://github.com/vikdiesel/admin-one-bulma-dashboard" target="_blank" class="button is-primary">
              <span class="icon"><i class="mdi mdi-github-circle"></i></span>
              <span>GitHub</span>
            </a>
          </div>
        </div>
      </div>
    </div>
  </section>

the problem is in my list.html

 {% extends "base/layout" %}
    {% embed "base/navbarSubtitle" %}
      {% block navbarSubtitle %} Sites {% endblock %}
    {% endembed %}
    {% block content %}
    {% include "sites/table" %}
        <div id="add"></div>
        <div id="edit"></div>
{% endblock %}

the word Sites is not rendered only the word Test, i noticed that if in my layout.html i remove the include tag and paste the html in there directly this works as expected ,so i think that something is missing in my implementation