[Doc-SIG] enumerated list item parsing fixed

David Goodger goodger@users.sourceforge.net
Thu, 15 Aug 2002 21:00:03 -0400


I've fixed the reStructuredText parser's handling of enumerated list
items to deal with the following edge cases:

- This text is parsed as a section title::

      1. This is the heading of section one
      =====================================

- This text is parsed as an ordinary paragraph:

      A. Einstein was a really
      smart dude.

  However, ambiguity cannot be avoided if the paragraph consists of
  only one line.  This text is parsed as an enumerated list item::
  
      A. Einstein was a really smart dude.
  
  If a single-line paragraph begins with text identical to an
  enumerator ("A.", "1.", "(b)", "I)", etc.), the first character will
  have to be escaped in order to have the line parsed as an ordinary
  paragraph::
  
      \A. Einstein was a really smart dude.

The code, spec, and test suite have been updated.  The code change
consists of checking the second line of each enumerated list item for
validity, in the parser's new ``Body.is_enumerated_list_item`` method.
Thanks to Jeremy Hylton and Dmitry Jemerov for their bug reports.

In addition, I implemented the "line-block" and "parsed-literal"
directives.  See http://docutils.sf.net/tools/test.html#line-blocks
for an example of the former; docs in
http://docutils.sf.net/spec/rst/directives.html.

The latest snapshot can always be downloaded from:

    http://docutils.sf.net/docutils-snapshot.tgz

-- 
David Goodger  <goodger@users.sourceforge.net>  Open-source projects:
  - Python Docutils: http://docutils.sourceforge.net/
    (includes reStructuredText: http://docutils.sf.net/rst.html)
  - The Go Tools Project: http://gotools.sourceforge.net/