djc / askama

Type-safe, compiled Jinja-like templates for Rust
Apache License 2.0
3.32k stars 214 forks source link

Detect duplicate blocks #680

Open vporton opened 2 years ago

vporton commented 2 years ago
{% extends "_base.html" %}

{% block head %}...{% endblock %}
{% block head %}...{% endblock %}

should not compile with error message Duplicate block "head" in page ....

djc commented 2 years ago

What do you propose it should do instead?

vporton commented 2 years ago

What do you propose it should do instead?

It should do a compilation error.

djc commented 2 years ago

Ah, your initial description had me confused since it seemed to imply to me that it was already throwing a compilation error but you thought it should not. I think this is probably reasonable... Would you be interested in submitting a PR? It shouldn't be too hard to do some error checking around https://github.com/djc/askama/blob/main/askama_shared/src/heritage.rs#L78.