erebor/asciidoctor — pull request #58 by mojavelinux (2013-01-07 10:13:09+00:00)
Title: Rework list reading to be more compliant & compact

Yes, again ;) I suffered a small setback when I realized that I has misinterpreted one of the rules governing how list items (specifically labeled lists) are read. I discovered that while I had plenty of tests, many were asserting the incorrect behavior. (...and took me most of the weekend to correct).

I had thought labeled lists were much more lenient about blank lines, when in fact it's really that there is a greedy and non-greedy mode depending on whether or not text is provided on the same line as the term.

Having made that correction, I realized the two types of lists (labeled and outline) share nearly identical rules and could thus merge the reader logic.

I also added 50, very specific tests to ensure lists are read properly. Those tests enabled me to delete several lines of code that were superfluous.

- rework lists, specifically dlists to follow proper scanning rules
- merge logic for handling labeled and outline lists
- more robust list continuations
- fix bug in folding first block of list item
- add :olist to LIST_CONTEXTS
- create constant NESTABLE_LIST_CONTEXTS to exclude :olists
- fix missing pipe in "any block" regexp
- don't capture endlines in :dlist regexp
- add a "text only" scan mode to next_block
- add method to reader to consume line comments
- many more tests to ensure compliant list behavior

On a side note, eventually I'd like to eliminate the first pass by the reader that precedes the parsing to blocks. It unnecessarily requires that we apply all the rules to the document twice, because in order to read you have to apply all the context rules (is this the start/end of a block or list) or else you don't grab the right lines. With a little effort, I think it can be done without any external impact. (we will still have separate parse and render steps).