Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6960 closed defect (duplicate)

HTMLParseError

Reported by: Guillaume Dufloux Owned by: Christian Boos
Priority: normal Milestone:
Component: wiki system Version:
Severity: normal Keywords: HTMLParser ruby parse_endtag render
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Hi,

Trac comes to an error when parsing a specific ruby expression. It seems to come from the python library HTMLParser.py, but impacts Trac when rendering through ruby wiki processor.

You can find such string in Rails application for instance: rails/actionpack/lib/action_view/helpers/text_helper.rb:390:

%(#{a}<a href="#{b=="www."?"http://www.":b}#{c}"#{extra_options}>#{text}</a>#{d})

Obviously, i did not use the ruby wiki processor to display this line, or you would never access this ticket lol (i used 'text'). However, the same line with some spaces added in the evaluated part (condition b=="www.") raises no error:

%(#{a}<a href="#{b=="www." ? "http://www." :b}#{c}"#{extra_options}>#{text}</a>#{d})

So that here, i can use the ruby wiki processor:

%(#{a}<a href="#{b=="www." ? "http://www." :b}#{c}"#{extra_options}>#{text}</a>#{d})

If you want a live demo, just have a look here.

Here is the traceback (most recent call last):

File "/opt/csw/lib/python2.3/site-packages/trac/web/main.py", line 406, in dispatch_request
dispatcher.dispatch(req)

File "/opt/csw/lib/python2.3/site-packages/trac/web/main.py", line 244, in dispatch
req.display(template, content_type or 'text/html')

File "/opt/csw/lib/python2.3/site-packages/trac/web/api.py", line 358, in display
data = self.hdf.render(template, form_token)

File "/opt/csw/lib/python2.3/site-packages/trac/web/clearsilver.py", line 296, in render
injector.feed(template.render())

File "/opt/csw/lib/python2.3/HTMLParser.py", line 108, in feed
self.goahead(0)

File "/opt/csw/lib/python2.3/HTMLParser.py", line 150, in goahead
k = self.parse_endtag(i)

File "/opt/csw/lib/python2.3/HTMLParser.py", line 327, in parse_endtag
self.error("bad end tag: %s" % `rawdata[i:j]`)

File "/opt/csw/lib/python2.3/HTMLParser.py", line 115, in error
raise HTMLParseError(message, self.getpos())

HTMLParseError: bad end tag: '</p">', at line 526, column 176

Regards, Guillaume

Attachments (0)

Change History (1)

comment:1 by Christian Boos, 17 years ago

Resolution: duplicate
Status: newclosed

Another one of the MostFrequentDuplicates.

Duplicate of #4365.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos 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.