Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#587 closed defect (fixed)

Restructured Text parsing - problem with leading spaces before a heading

Reported by: andre@… Owned by: daniel
Priority: normal Milestone: 0.8
Component: wiki system Version: 0.7.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Description

To reproduce the problem:

Create a new Wiki page, define Restructured Text formatting, then add a ReST heading in the normal manner, but with one or more leading spaces. Hit 'save', or 'preview'.

Trac then issues the following error, and a traceback.

Apologies in advance if this is a false alarm - I know it's bad formatting as far as docutils is concerned. But shouldn't Trac catch the exception gracefully, rather than dumping a traceback?

Here is the error that's produced:

Trac detected an internal error:

:3: (SEVERE/4) Unexpected section title.

Here is the traceback that's produced:

Traceback (most recent call last):
  File "/usr/local/lib/python2.3/site-packages/trac/core.py", line 475, in cgi_start
    real_cgi_start()
  File "/usr/local/lib/python2.3/site-packages/trac/core.py", line 470, in real_cgi_start
    dispatch_request(path_info, args, req, env, database)
  File "/usr/local/lib/python2.3/site-packages/trac/core.py", line 380, in dispatch_request
    module.run()
  File "/usr/local/lib/python2.3/site-packages/trac/Module.py", line 41, in run
    self.render()
  File "/usr/local/lib/python2.3/site-packages/trac/Wiki.py", line 766, in render
    Formatter(self.req.hdf, self.env).format(self.page.text, out)
  File "/usr/local/lib/python2.3/site-packages/trac/Wiki.py", line 493, in format
    self.handle_code_block(line)
  File "/usr/local/lib/python2.3/site-packages/trac/Wiki.py", line 454, in handle_code_block
    self.out.write(self.code_processor(self.hdf, self.code_text, self.env))
  File "/usr/local/lib/python2.3/site-packages/trac/wikimacros/rst.py", line 142, in execute
    html = publish_string(text, writer_name = 'html', parser = _parser)
  File "/usr/local/lib/python2.3/site-packages/docutils/core.py", line 336, in publish_string
    return pub.publish(enable_exit=enable_exit)
  File "/usr/local/lib/python2.3/site-packages/docutils/core.py", line 168, in publish
    document = self.reader.read(self.source, self.parser, self.settings)
  File "/usr/local/lib/python2.3/site-packages/docutils/readers/__init__.py", line 65, in read
    self.parse()
  File "/usr/local/lib/python2.3/site-packages/docutils/readers/__init__.py", line 71, in parse
    self.parser.parse(self.input, document)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/__init__.py", line 122, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/states.py", line 170, in run
    input_source=document['source'])
  File "/usr/local/lib/python2.3/site-packages/docutils/statemachine.py", line 232, in run
    context, next_state, result = self.check_line(
  File "/usr/local/lib/python2.3/site-packages/docutils/statemachine.py", line 416, in check_line
    return method(match, context, next_state)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/states.py", line 1236, in indent
    blockquote, messages = self.block_quote(indented, line_offset)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/states.py", line 1247, in block_quote
    self.nested_parse(blockquote_lines, line_offset, blockquote)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/states.py", line 273, in nested_parse
    node=node, match_titles=match_titles)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/states.py", line 202, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/local/lib/python2.3/site-packages/docutils/statemachine.py", line 232, in run
    context, next_state, result = self.check_line(
  File "/usr/local/lib/python2.3/site-packages/docutils/statemachine.py", line 416, in check_line
    return method(match, context, next_state)
  File "/usr/local/lib/python2.3/site-packages/docutils/parsers/rst/states.py", line 2619, in underline
    nodes.literal_block(blocktext, blocktext), line=lineno)
  File "/usr/local/lib/python2.3/site-packages/docutils/utils.py", line 225, in severe
    return self.system_message(4, *args, **kwargs)
  File "/usr/local/lib/python2.3/site-packages/docutils/utils.py", line 184, in system_message
    raise SystemMessage(msg)
SystemMessage: :3: (SEVERE/4) Unexpected section title.

heading 1
=========


Attachments (0)

Change History (3)

comment:1 by daniel, 15 years ago

Milestone: 0.8

I believe it is a correct rest error, although a nicer error output would be nice.

comment:2 by daniel, 15 years ago

Owner: changed from Jonas Borgström to daniel
Status: newassigned

comment:3 by daniel, 15 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [826].

Modify Ticket

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