Commit f6b061c7 by Calen Pennington

Improve ability to discriminate between django and mako template

Django-format comments are now used to detect a django template.
Note: Django templates are still not linted.
parent a08447e4
...@@ -578,6 +578,7 @@ class TestMakoTemplateLinter(TestLinter): ...@@ -578,6 +578,7 @@ class TestMakoTemplateLinter(TestLinter):
@data( @data(
{'template': '{% extends "wiki/base.html" %}'}, {'template': '{% extends "wiki/base.html" %}'},
{'template': '{{ message }}'}, {'template': '{{ message }}'},
{'template': '{# comment #}'},
) )
def test_check_mako_on_django_template(self, data): def test_check_mako_on_django_template(self, data):
""" """
......
...@@ -2003,7 +2003,7 @@ class MakoTemplateLinter(BaseLinter): ...@@ -2003,7 +2003,7 @@ class MakoTemplateLinter(BaseLinter):
True if this is really a Django template, and False otherwise. True if this is really a Django template, and False otherwise.
""" """
if re.search('({%.*%})|({{.*}})', mako_template) is not None: if re.search('({%.*%})|({{.*}})|({#.*#})', mako_template) is not None:
return True return True
return False return False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment