Edgewall Software

Changes between Version 3 and Version 4 of TracDev/JinjaChecker


Ignore:
Timestamp:
Jul 27, 2016, 9:47:08 AM (8 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/JinjaChecker

    v3 v4  
    1 = `jinjachecker`
     1= Jinjachecker
    22
    3 Jinja2 is very helpful when it detects any kind of error, as you always end up with a meaningful backtrace. Nevertheless, it can be tedious to get the nesting of control structures right.
    4 
    5 To help with that problem, we wrote the [source:cboos.git/contrib/jinjachecker.py contrib/jinjachecker.py] tool.
     3Jinja2 is very helpful when it detects any kind of error, as you always end up with a meaningful backtrace. Nevertheless, it can be tedious to get the nesting of control structures right. To help with that problem, we wrote the [source:cboos.git/contrib/jinjachecker.py contrib/jinjachecker.py] tool.
    64
    75It first analyzes the Jinja2 control structures, and tries to provide some helpful diagnostics in case of nesting or stylistic errors.
    8 It also adds curly braces to the statements, so if you have an editor which can do matching of brace pairs, you can quickly spot the origin o a nesting problem.
     6It also adds curly braces to the statements, so if you have an editor which can do matching of brace pairs, you can quickly spot the origin of a nesting problem.
    97
    108Finally, while the indentation of the statements is free in Jinja2 templates, being consistent with it also helps to ensure a proper nesting.
     
    1311
    1412The command:
    15 {{{
     13{{{#!sh
    1614python contrib/jinjachecker.py trac/wiki/templates/jwiki_view.html
    1715}}}
     
    158156
    159157== Known Issues
     158
    160159The tool won't yet detect nesting mistakes when the Jinja2 control structure nesting and the HTML element nesting are both independently correct (e.g. errors like the one fixed in [68094c2ea/cboos.git]). //This might be fixed in a 3rd pass, doing XML validation after having replaced the Jinja2 start/end keywords with "equivalent" XML elements.//