feat(t002): allow variables names to be used in the {% extends tag

closes #349
This commit is contained in:
Christopher Pickering 2022-08-24 08:50:56 -05:00
parent f1a39ed289
commit a5d96e7a2d
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
2 changed files with 6 additions and 1 deletions

View file

@ -25,7 +25,7 @@
message: Double quotes should be used in tags.
flags: re.DOTALL
patterns:
- '{%.?extends\s+?[^\"]\w+'
- "{%[ \t]*?extends[ \t]+?'[^']*'"
- rule:
name: T003
message: 'Endblock should have name. Ex: {% endblock body %}.'

View file

@ -69,6 +69,11 @@ def test_T002(runner: CliRunner, tmp_file: TextIO) -> None:
assert result.exit_code == 1
assert "T002 1:" in result.output
# allow variable names (unquoted)
write_to_file(tmp_file.name, b"{% extends this %}")
result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"])
assert "T002" not in result.output
def test_T003(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(tmp_file.name, b"{% endblock %}")