Modify

Opened 7 months ago

Closed 7 months 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
Odd condition with TracTicketChangelogPlugin being ENABLED
Normal with TracTicketChangelogPlugin being DISABLED
Normal conditon 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).

In the HTML DOM  we can see that suddenly the "blo" is outside the `#content.ticket` box.

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)

normal.png (156.2 KB) - added by clemens 7 months ago.
Normal conditon with TracTicketChangelogPlugin being DISABLED
odd.png (174.4 KB) - added by clemens 7 months ago.
Odd condition with TracTicketChangelogPlugin being ENABLED
dom.png (249.5 KB) - added by clemens 7 months ago.
In the HTML DOM we can see that suddenly the "blo" is outside the #content.ticket box.

Download all attachments as: .zip

Change History (6)

Changed 7 months ago by clemens

Attachment: normal.png added

Normal conditon with TracTicketChangelogPlugin being DISABLED

Changed 7 months ago by clemens

Attachment: odd.png added

Odd condition with TracTicketChangelogPlugin being ENABLED

Changed 7 months ago by clemens

Attachment: dom.png added

In the HTML DOM we can see that suddenly the "blo" is outside the #content.ticket box.

comment:1 Changed 7 months ago by Ryan J Ollos

Status: newaccepted

comment:2 Changed 7 months ago by Jun Omae

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>

comment:3 Changed 7 months ago by Ryan J Ollos

Resolution: cantfix
Status: acceptedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.