mirror of https://github.com/zulip/zulip.git
Extract matching_tags() in check-templates.
(imported from commit bf54e656ba5f924298270c8e76b60faf78689099)
This commit is contained in:
parent
7e49396fc5
commit
f22665e710
|
@ -29,7 +29,7 @@ def validate(fn, check_indent=True):
|
||||||
old_matcher = state.matcher
|
old_matcher = state.matcher
|
||||||
def f(end_tag):
|
def f(end_tag):
|
||||||
problem = None
|
problem = None
|
||||||
if start_tag != end_tag[2:-1]:
|
if not matching_tags(start_tag, end_tag):
|
||||||
problem = 'Mismatched tag.'
|
problem = 'Mismatched tag.'
|
||||||
elif check_indent and state.line > start_line + 1 and state.col != start_col:
|
elif check_indent and state.line > start_line + 1 and state.col != start_col:
|
||||||
problem = 'Bad indentation.'
|
problem = 'Bad indentation.'
|
||||||
|
@ -92,6 +92,9 @@ def get_html_tag(text, i):
|
||||||
s = text[i:end+1]
|
s = text[i:end+1]
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
def matching_tags(start_tag, end_tag):
|
||||||
|
return start_tag == end_tag[2:-1]
|
||||||
|
|
||||||
def check_our_files():
|
def check_our_files():
|
||||||
git_files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
|
git_files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue