Comments
Patch
@@ -367,6 +367,16 @@
[]
]
+webtemplatefilters = []
+
+webtemplatepats = [
+ [],
+ [
+ (r'{desc(\|(?!websub|firstline)[^\|]*)*}',
+ 'follow desc keyword with either firstline or websub'),
+ ]
+]
+
checks = [
('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
@@ -377,6 +387,8 @@
('layering violation ui in util', r'mercurial/util\.py', '', pyfilters,
inutilpats),
('txt', r'.*\.txt$', '', txtfilters, txtpats),
+ ('web template', r'mercurial/templates/(?!raw).*\.tmpl', '',
+ webtemplatefilters, webtemplatepats),
]
def _preparepats():
@@ -284,3 +284,18 @@
> print _(
don't use % inside _()
[1]
+
+web templates
+
+ $ mkdir -p mercurial/templates
+ $ cat > mercurial/templates/example.tmpl <<EOF
+ > {desc}
+ > {desc|firstline}
+ > {desc|websub}
+ > EOF
+
+ $ "$check_code" --warnings mercurial/templates/example.tmpl
+ mercurial/templates/example.tmpl:1:
+ > {desc}
+ warning: follow desc keyword with either firstline or websub
+ [1]