gettalong/kramdown — pull request #131 by mivok (2014-06-07 06:02:55+00:00)
Title: Fix location with nested lists

When parsing nested lists, the reported location of the sub lists is off by one. I believe I've tracked it down to the following: when a nested list is detected, an EOB marker is inserted, causing the line numbers for everything parsed afterward to be increased by 1. This PR corrects for this by decreasing the line number once an EOB marker is detected.

I'm not sure this is the best way to fix the issue (I had to make Kramdown::StringScanner.start_line_number writable), and you might want to implement it differently.

Test case is included, but to illustrate the issue in a standalone file:

#!/usr/bin/env ruby
require 'kramdown'
text = <