Opened 4 years ago
Closed 4 years ago
#13959 closed defect (cantfix)
odd behaviour when using wrong wiki syntax
Reported by: | clemens | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | TracTicketChangelogPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.4 |
Description
The TracTicketChangelogPlugin (Version 1.2.0dev, r17251, 2018-07-30) can cause problems during HTML rendering of the ticket view if a weird superscript syntax is used inside a table.
Of course correct superscript wiki syntax is as follows x^y^
, but if you omit the second caret then problems arise.
This is an example of the wrong superscript syntax. Take notice of the missing second caret.
bli || bla^1 || blo
Compare these two screen-shots:
- Odd with TracTicketChangelogPlugin being ENABLED
- Normal with TracTicketChangelogPlugin being DISABLED
In the HTML DOM (see figure below) we can see that suddenly the "blo" and all other ticket description text is outside the #content.ticket
box.
The "Commit History" is inside the #content.ticket
box and is rendered properly. But all following ticket sections (attachments, change history, modify ticket...) are outside the #content.ticket
box. One effect is that these sections are not centred anymore (due to CSS rules not matching anymore).
I have the feeling that this problem is not only related to the TracTicketChangelogPlugin. Maybe other plugins are affected too. I do not have a final evidence, but I have hints that also inserting the ticket_clone.py plugin can cause the same problems. (Which is not an issue for me, because in my TRAC 1.4.2 this plugin is obsolete anyway)
Of course the work around is simple: "Let's use correct wiki syntax then!" But sometimes users make those syntax errors.
Attachments (3)
Change History (6)
Changed 4 years ago by
Attachment: | normal.png added |
---|
Changed 4 years ago by
Odd condition with TracTicketChangelogPlugin being ENABLED
Changed 4 years ago by
In the HTML DOM we can see that suddenly the "blo" is outside the #content.ticket
box.
comment:1 Changed 4 years ago by
Status: | new → accepted |
---|
comment:2 Changed 4 years ago by
The issue is caused by Trac core and Genshi.
Trac generates malformed html for || bbb^1 ||
:
</sup>
should be put before </td>
.
>>> env = EnvironmentStub() >>> req = MockRequest(env) >>> context = web_context(req) >>> print(format_to_html(env, context, text)) <p> aaa </p> <table class="wiki"> <tr><td> bbb<sup>1 </td></tr></table> </sup><p> ccc </p>
Genshi closes all tags and inserts fragment before <p>ccc</p>
for the malformed input.
>>> from genshi.core import Markup >>> from genshi.builder import tag >>> from genshi.filters.transform import Transformer from genshi.input import HTML >>> from genshi.input import HTML >>> >>> stream = HTML(u'<html><body><div>{}</div></body></html>'.format(format_to_html(env, context, text))) >>> stream |= Transformer('//div').after(tag.div('transform')) >>> print(unicode(stream)) <html><body><div><p> aaa </p> <table class="wiki"> <tr><td> bbb<sup>1 </sup></td></tr></table> </div><div>transform</div></body></html><p> ccc </p>
Normal conditon with TracTicketChangelogPlugin being DISABLED