##// END OF EJS Templates
check-code: check for consistent usage of the websub filter in hgweb templates...
Steven Brown -
r21487:c26464ce default
parent child Browse files
Show More
@@ -367,6 +367,16 b' inrevlogpats = ['
367 367 []
368 368 ]
369 369
370 webtemplatefilters = []
371
372 webtemplatepats = [
373 [],
374 [
375 (r'{desc(\|(?!websub|firstline)[^\|]*)+}',
376 'follow desc keyword with either firstline or websub'),
377 ]
378 ]
379
370 380 checks = [
371 381 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
372 382 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
@@ -377,6 +387,8 b' checks = ['
377 387 ('layering violation ui in util', r'mercurial/util\.py', '', pyfilters,
378 388 inutilpats),
379 389 ('txt', r'.*\.txt$', '', txtfilters, txtpats),
390 ('web template', r'mercurial/templates/.*\.tmpl', '',
391 webtemplatefilters, webtemplatepats),
380 392 ]
381 393
382 394 def _preparepats():
@@ -284,3 +284,19 b''
284 284 > print _(
285 285 don't use % inside _()
286 286 [1]
287
288 web templates
289
290 $ mkdir -p mercurial/templates
291 $ cat > mercurial/templates/example.tmpl <<EOF
292 > {desc}
293 > {desc|escape}
294 > {desc|firstline}
295 > {desc|websub}
296 > EOF
297
298 $ "$check_code" --warnings mercurial/templates/example.tmpl
299 mercurial/templates/example.tmpl:2:
300 > {desc|escape}
301 warning: follow desc keyword with either firstline or websub
302 [1]
General Comments 0
You need to be logged in to leave comments. Login now