mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-23 20:25:49 +00:00
updated rule for img tag, and links in other tags
This commit is contained in:
parent
80df22b514
commit
2aa39f4199
2 changed files with 8 additions and 4 deletions
|
|
@ -48,6 +48,8 @@ Warning Codes
|
|||
+--------+----------------------------------------------------------------+
|
||||
| W017 | Tag should be self closing. |
|
||||
+--------+----------------------------------------------------------------+
|
||||
| W018 | Internal links should use the {% url ... %} pattern. |
|
||||
+--------+----------------------------------------------------------------+
|
||||
|
||||
Adding Rules
|
||||
------------
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@
|
|||
message: Img tag should have alt, height and width attributes.
|
||||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- <img\s(?:(?!(?:alt|width|height)).)*>
|
||||
- <img\s(?:(?!(?:height)=).)*/?>
|
||||
- <img\s(?:(?!(?:width)=).)*/?>
|
||||
- <img\s(?:(?!(?:alt)=).)*/?>
|
||||
- rule:
|
||||
name: W007
|
||||
message: <!DOCTYPE ... > should be present before the html tag.
|
||||
|
|
@ -71,10 +73,10 @@
|
|||
- (?:CLASS|ID|SRC|WIDTH|HEIGHT|ALT|STYLE|LANG|TITLE)=
|
||||
- rule:
|
||||
name: W011
|
||||
message: Attirbute values should be quoted.
|
||||
message: Attribute values should be quoted.
|
||||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- "[^(?:\"|')](?:class|id|src|width|height|alt|style|lang|title)=[a-zA-Z]+"
|
||||
- "[^(?:\"|')]\\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z]+"
|
||||
- rule:
|
||||
name: W012
|
||||
message: There should be no spaces around attribute =.
|
||||
|
|
@ -117,5 +119,5 @@
|
|||
message: Internal links should use the {% url ... %} pattern.
|
||||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- <a\s+?[^>]*?(?:href|data-url)=[\"|'](?!https?://)[\w|/]+
|
||||
- <(?:a|div|span|input)\s+?[^>]*?(?:href|data-url|data-ajax)=[\"|'](?!https?://)[\w|/]+
|
||||
- <form\s+?[^>]*?(?:action)=[\"|'](?!https?://)[\w|/]+
|
||||
|
|
|
|||
Loading…
Reference in a new issue