Safe template linter should use DOTALL

MULTILINE has to do with how '^' and '$' behave, DOTALL will make the
'.' match newlines as well. This catches several failures that were
previously missed.
This commit is contained in:
Eric Fischer
2016-03-23 15:59:29 -04:00
parent 08ddeca426
commit 7cfa0fa111

View File

@@ -773,7 +773,7 @@ class UnderscoreTemplateLinter(object):
end_index: The index of the end of the expression.
expression: The text of the expression.
"""
unescaped_expression_regex = re.compile("<%=.*?%>", re.MULTILINE)
unescaped_expression_regex = re.compile("<%=.*?%>", re.DOTALL)
expressions = []
for match in unescaped_expression_regex.finditer(underscore_template):