#13589 closed defect (invalid)
`#!html` processor incorrectly closes at end of wiki text, not `}}}`
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | wiki system | Version: | 1.4.3 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
If I set the style in a {{{#!html ... }}}
section, this leaks into the rest of the wicket or wiki page:
The text I used is:
= HTML Leak {{{#!html <div style="background-color:lightgrey;"> <h4>Header</h4> <p>Some text...</p> }}} Background leaks here... = Next section Background leaks here too...
I would expect all HTML settings and other features that I use or changes that I make inside a {{{ ... }}}
block, that they are limited to this block.
Attachments (2)
Change History (10)
by , 20 months ago
Attachment: | html_leak.png added |
---|
comment:1 by , 20 months ago
comment:2 by , 20 months ago
Description: | modified (diff) |
---|
comment:3 by , 20 months ago
Component: | general → wiki system |
---|---|
Milestone: | → 1.4.4 |
Summary: | {{{#!html style leaks into ticket and wiki → `#!html` processor incorrectly closes at end of wiki text, not `}}}` |
Version: | → 1.4.3 |
Thanks for the reporting.
Another example
= Header 1 Pre text. {{{#!html <div style="border:2px solid orange;padding:1em"> <h4>Header 4</h4> <p>Some text...</p> }}} Post text. = Header 2 Pre text. {{{#!html <div style="border:2px solid blue;padding:1em"> <h4>Header 4</h4> <p>Some text...</p> }}} Post text.
Result:
by , 20 months ago
Attachment: | t13589-bad-wiki.png added |
---|
comment:4 by , 20 months ago
Milestone: | 1.4.4 |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Ah. That is caused by missing </div>
in the #!html
processor.
{{{#!html <div style="background-color:lightgrey;"> <h4>Header</h4> <p>Some text...</p> </div> <!-- MISSING --> }}}
follow-up: 6 comment:5 by , 20 months ago
I know the </div>
is missing. But that is not the issue here.
Anything you do inside {{{ ... }}}
should not affect the rest of the ticket or wiki page.
The closing }}}
should restore the style sheet of the ticket or wiki page.
comment:6 by , 20 months ago
Milestone: | → next-stable-1.4.x |
---|
Replying to geert.linders@…:
I know the
</div>
is missing. But that is not the issue here.Anything you do inside
{{{ ... }}}
should not affect the rest of the ticket or wiki page.The closing
}}}
should restore the style sheet of the ticket or wiki page.
You know? You didn't explain that. Well, add </div>
as a workaround.
Hm. Document for #!html
processor says in WikiHtml:
The filtering is done by Genshi and the output will be a well-formed fragment of HTML. This means that you cannot use two HTML blocks, one for opening a <div> and another for closing it, in order to wrap arbitrary wiki text.
Currently, the output of #!html
processor with unbalanced tags is not a well-formed fragment.
>>> from trac.test import EnvironmentStub, MockRequest >>> from trac.wiki.formatter import format_to_html >>> from trac.web.chrome import web_context >>> env = EnvironmentStub() >>> req = MockRequest(env) >>> context = web_context(req) >>> text = """\ ... aaa ... {{{#!html ... <div> ... text ... }}} ... bbb ... """ >>> print(format_to_html(env, context, text)) <p> aaa </p> <div> text <p> # <== </div> should be automatically added before <p> bbb </p>
comment:7 by , 20 months ago
Sorry I didn't mention the unbalanced <div>
tag.
So it seems we do have an issue. Although probably a minor one because there is a simple workaround.
comment:8 by , 14 months ago
Milestone: | next-stable-1.4.x |
---|
Oops! Forgot to add my email address.