#13307 closed defect (fixed)
jinjachecker doesn't correctly parse multiline expressions
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.2 |
Component: | general | Version: | |
Severity: | normal | Keywords: | jinjachecker |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Fixed |
Description (last modified by )
./contrib/jinjachecker.py trac/templates/environment_info.html -j [...] 51 {IF plugins: 61 {FOR plugin in plugins: 62 SET components = plugin.modules|map(attribute='components')|flatten 65 SET url = (plugin.info.home_page or 69 {IF url: [...]
However, markup is:
# set url = (plugin.info.home_page or plugin.info.author_email and 'mailto:' + plugin.info.author_email)
Output of jinjachecker should be:
[...] 51 {IF plugins: 61 {FOR plugin in plugins: 62 SET components = plugin.modules|map(attribute='components')|flatten 65 SET url = (plugin.info.home_page or 66 plugin.info.author_email and 67 'mailto:' + plugin.info.author_email) 69 {IF url: [...]
Attachments (0)
Change History (7)
comment:2 by , 4 years ago
Replying to Ryan J Ollos:
jinjachecker
doesn't recognize the content as being in a block, so thediv
is needed to avoid an error.
Ah, ## jinjacheck
markup can be used to mark the errors as OK.
comment:3 by , 4 years ago
Replying to Ryan J Ollos:
The reason the fix matters is that before the fix the HTML content discovered by
jinjachecker
is:37 38 39 show_history else max_version) 40 41 comment_version == max_version) 42 43 44 <a href="#comment:${cnum}" class="${cls}">${prefix}${cnum}</a>
The error is silenced by the jinjacheck: "CDATA" OK.
When that is removed:
trac/ticket/templates/ticket_change.html:249:8: Element body content does not follow the DTD, expecting (p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | noscript | ins | del | script)*, got (CDATA a h3 div form div div div div ) # -- HTML 1 errors One error found.
comment:4 by , 4 years ago
Internal Changes: | modified (diff) |
---|---|
Owner: | set to |
Status: | new → assigned |
Proposed changes log:rjollos.git:t13307_jinjachecker_multiline.
comment:5 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 4 years ago
Description: | modified (diff) |
---|
Related, in r17372 I wrapped the block in a
div
to avoid this error:jinjachecker
doesn't recognize the content as being in a block, so thediv
is needed to avoid an error. Thediv
won't be rendered since it's in a child template and outside a block, so it seems to work fine. Aside, When the script is converted to usepytidylib
, maybe the blocks should be extracted and parsed usingtidy_fragment
?After fixing the issue in comment:description, a similar issue is seen:
jinjachecker
doesn't recognize the content as being amacro
: tags/trac-1.4.1/trac/ticket/templates/ticket_change.html@:43-45#L26.The reason the fix matters is that before the fix the HTML content discovered by
jinjachecker
is:This is the same multiline statement problem in comment:description, and seems to obscure
jinjachecker
from discovering the DTD error.