Login
or
register
Overview
Introduction
Features
Credits
License
This Wiki
Status
News
Releases
Change Log
Recent Wiki Edits
User Guide
Installation
Command Line
Using as a Module
Integration
Reporting Bugs
Advanced
Mailing List
Source Code
Test Suite
Extensions
Extensions
Writing Extensions
Available Extensions
Related Projects
Tickets
▹ 000054
Lists with spaces
Anonymous users must enter
captcha
below.
Don't put anything here
Don't put anything here
Ticket Information
Don't put anything here
Ticket Title
One of my users found a weird bug when entering some Markdown in a Django form. If you include more spaces after the bullet than in the markdown tab length, then the blockparser throws an error. (IndexError: child index out of range) To replicate: 1. Check markdown.TAB_LENGTH 2. Enter text starting with a bullet and then more spaces than in the TAB_LENGTH 3. Try to run it through markdown (Note in below example there are 5 fives between * and test in the first line) >>> text = '* test' >>> markdown.markdown(text) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.5/site-packages/markdown/__init__.py", line 587, in markdown return md.convert(text) File "/Library/Python/2.5/site-packages/markdown/__init__.py", line 389, in convert root = self.parser.parseDocument(self.lines).getroot() File "/Library/Python/2.5/site-packages/markdown/blockparser.py", line 60, in parseDocument self.parseChunk(self.root, '\n'.join(lines)) File "/Library/Python/2.5/site-packages/markdown/blockparser.py", line 75, in parseChunk self.parseBlocks(parent, text.split('\n\n')) File "/Library/Python/2.5/site-packages/markdown/blockparser.py", line 92, in parseBlocks processor.run(parent, blocks) File "/Library/Python/2.5/site-packages/markdown/blockprocessors.py", line 295, in run self.parser.parseBlocks(lst[-1], [item]) IndexError: child index out of range >>> markdown.TAB_LENGTH 4 >>> markdown.TAB_LENGTH = 7 >>> markdown.markdown(text) u'<ul>\n<li>test</li>\n</ul>' >>> **UPDATE** The problem appears to be that it sees the spaces as being indentation and assumes it has a parent because the indentation is there. (Not sure why it's not checking the indentation _before_ the *, but I didn't look far enough). Adding a check to blockprocessors.py seems to fix it: line 293: if ((item.startswith(' '*markdown.TAB_LENGTH)) and (len(lst) > 0)): at least, it doesn't throw an error, although you then run into my other ticket about it creating a paragraph, rather than list items. **IGNORE ME** I hadn't upgraded to 2.0.3
Reported by
Assigned to
Status
open
someday
resolved
closed
Resolution
n.a.
fixed
wontfix
Advanced Fields
Priority
unassigned
high
medium
low
Resolution Explanation
Component
About This Edit
Minor Edit
Edit Summary
Don't put anything here
Don't put anything here
Don't put anything here
save
preview
cancel
Powered by
Sputnik
|
XHTML 1.1