diff --git a/src/djlint/lint.py b/src/djlint/lint.py index 85ae074..07a5afa 100644 --- a/src/djlint/lint.py +++ b/src/djlint/lint.py @@ -76,7 +76,7 @@ def lint_file(config: Config, this_file: Path) -> Dict: { "code": rule["name"], "line": get_line(match.start(), line_ends), - "match": match.group()[:20].strip(), + "match": match.group().strip()[:20], "message": rule["message"], } ) diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index 14eb96f..9e54514 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -85,9 +85,9 @@ - rule: name: H011 message: Attribute values should be quoted. - flags: re.DOTALL|re.I + flags: re.DOTALL|re.I|re.M patterns: - - "[^(?:\"|')]\\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z]+" + - ^^[^(?:"|')]*?\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z_-]+ - rule: name: H012 message: There should be no spaces around attribute =.