Edgewall Software
Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#11009 closed defect (fixed)

Bold WikiFormatting leaking outside ticket body

Reported by: Andrew C. Martin <andrew.c.martin@…> Owned by: Peter Suter
Priority: high Milestone: 0.12.6
Component: wiki system Version:
Severity: major Keywords: formatter
Cc: andrewcmartin@…, Jun Omae Branch:
Release Notes:

Fix bad html produced when a binary markup tag (e.g. **) immediately follows a wiki list.

API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Having the following text in a ticket will result in all subsequent ticket description, comments, and workflow text to default to a bold font weight. The WikiFormatting should not extend past the scope in which it is started.

***
* 
***

Note there is one space on the second line.

I've verified this bug in Trac 0.12.3 and Trac 1.0.1dev-r11320


For a demo, see ticket:11009?version=4 (I had to "fix" the description, as this prevented making further changes, at least with Chrome, see comment:5). — cboos

Attachments (1)

T11009-list-wikiformat-leak.patch (4.2 KB ) - added by Peter Suter 10 years ago.
Close list before checking open tags.

Download all attachments as: .zip

Change History (14)

comment:1 by Andrew C. Martin <andrew.c.martin@…>, 11 years ago

This comment does not have any bold WikiFormatting.

comment:2 by Andrew C. Martin <andrew.c.martin@…>, 11 years ago

This comment does have bold WikiFormatting.

comment:3 by Andrew C. Martin <andrew.c.martin@…>, 11 years ago

Description: modified (diff)

comment:4 by Peter Suter, 11 years ago

Component: renderingwiki system
Keywords: formatter added
Milestone: topic-wikiengine

Seems like a list item immediately followed by some opening tag is broken. Closing the list flushes all tags including the closing tag corresponding to the opening tag yet to be written. So this also affects e.g. ordered lists and italic text:

1. The list item
//The closing tag that should follow this opening tag was flushed out when closing the list

results in:

<ol><li>The list item
</em></li></ol></p>
<em>The closing tag that should follow this opening tag was flushed out to close the list
</p>

comment:5 by Christian Boos, 11 years ago

Description: modified (diff)

Italic as well, of course, as still visible in ticket:11013?version=0.

And somehow this propagates to breaking the dynamic preview, and sometimes prevent updating the ticket (I couldn't save my change to #11013 until I fixed the formatting of the description, due to the "someone else modified the ticket in the meantime" error). I suppose it's simply due to the broken HTML structure we end up with.

Ah, and same thing here, now.

comment:6 by Christian Boos, 11 years ago

Description: modified (diff)
Priority: normalhigh
Severity: normalmajor

comment:7 by Jun Omae, 10 years ago

Cc: Jun Omae added

#11373 was closed as duplicate. Also, proposed changes can be found in log:jomae.git:ticket11009_0.12.6dev.

in reply to:  7 ; comment:8 by Jun Omae, 10 years ago

#11373 was closed as duplicate. Also, proposed changes can be found in log:jomae.git:ticket11009_0.12.6dev.

Could someone review the patch?

by Peter Suter, 10 years ago

Close list before checking open tags.

in reply to:  8 ; comment:9 by Peter Suter, 10 years ago

Replying to jomae:

log:jomae.git:ticket11009_0.12.6dev.

Could someone review the patch?

Looks almost good to me.

But I think _indirect_tag_handler should first close any lists if needed and only then check if the tag is already open. Otherwise the following fails:

 1. //italic in list
//italic
in paragraph

With your patch _indirect_tag_handler:

  1. First checks if the // tag is open (yes)
  2. Then closes the list (this flushes and closes the open // tag)
  3. Attempts to close the // tag again (because the check in 1. said yes).

Fixing this actually simplifies the code. I added this testcase, the simplified _indirect_tag_handler and a similar simplification of _bolditalic_formatter to your code in the attached patch.

Version 0, edited 10 years ago by Peter Suter (next)

comment:10 by Peter Suter, 10 years ago

Milestone: topic-wikiengine0.12.6

in reply to:  9 comment:11 by Jun Omae, 10 years ago

Fixing this actually simplifies the code. I added this testcase, the simplified _indirect_tag_handler and a similar simplification of _bolditalic_formatter to your code in the attached patch.

Thanks for reviewing. Your patch looks pretty good rather than my patch. Please commit!

comment:12 by Peter Suter, 10 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Committed in [12549] and merged in [12550-12551].

comment:13 by Peter Suter, 10 years ago

Owner: set to Peter Suter

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Peter Suter to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.