mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-16 21:40:24 +00:00
parent
d43513a8e5
commit
ebd099f011
2 changed files with 10 additions and 1 deletions
|
|
@ -136,7 +136,7 @@
|
|||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:|data:)[\w|/]+
|
||||
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+
|
||||
- <form\b[^>]*?(?:\saction)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+
|
||||
- rule:
|
||||
name: J018
|
||||
message: (Jinja) Internal links should use the {{ url_for() ... }} pattern.
|
||||
|
|
|
|||
|
|
@ -451,6 +451,15 @@ def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
|
||||
assert result.exit_code == 0
|
||||
|
||||
# test data-actions
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b"""<form action="{% url 'something' %}" data-action="xxx"></form>""",
|
||||
)
|
||||
|
||||
result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"])
|
||||
assert "D018" not in result.output
|
||||
|
||||
|
||||
def test_H019(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b"<a href='javascript:abc()'>asdf</a>")
|
||||
|
|
|
|||
Loading…
Reference in a new issue