mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-17 05:50:24 +00:00
feat(t002): allow variables names to be used in the {% extends tag
closes #349
This commit is contained in:
parent
f1a39ed289
commit
a5d96e7a2d
2 changed files with 6 additions and 1 deletions
|
|
@ -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 %}.'
|
||||
|
|
|
|||
|
|
@ -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 %}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue