tera icon indicating copy to clipboard operation
tera copied to clipboard

Inconsistent inheritance when mixing include and blocks

Open posiczko opened this issue 5 years ago • 2 comments

When I create a partial that's included in parent html and that partial contains a block, that block is not being overridden when in a child overrides it:

  1. I create a base.html with:
<!DOCTYPE html>
<html>
  {% include "header.html" %}
</html>
  1. I create a header.html with:
<head>
  <title>{% block title %}Title in Header{% endblock title %}</title>
</head>
  1. I create article.html with:
{% extends "base.html" %}
{% block title %}
    <title>Article Title</title>
{% endblock title %}

Expected behavior is for title block from article.html to override base.html. It does not.

This may be related to feature #532 with inheritance breaking macros import.

Thank you!

posiczko avatar Jan 12 '21 17:01 posiczko

I met this problem too.

CliffHan avatar Dec 06 '21 07:12 CliffHan

It's the same yes. The current parser is not very smart and doesn't handle cases like this or macros well. It will be fixed for v2

Keats avatar Dec 06 '21 12:12 Keats