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
▹ 000044
Unexpected results with <pre> and <code> tags.
Anonymous users must enter
captcha
below.
Ticket Information
Ticket Title
I'm assuming their is a bug in the HTMLBlockPreprocessor that messes up the tabbing of the content in a pre or code block. If you have an empty line, then the following line loses its tabs/spaces. Here's an example: <pre> >>> import markdown >>> >>> code = """ ... <pre> ... class Test: ... hello = "world" ... ... def greet(self, name): #WILL FAIL ... print name ... </pre> ... """ >>> >>> md = markdown.markdown(code) >>> >>> print md <pre> class Test: hello = "world" def greet(self, name): #FAILED print name </pre> >>> </pre> As you can see, it will remove the tab from the beginning of `def greet`. I haven't had a chance to dive into the code, but I can only assume it has something to do with how it's splitting the lines. Let me know if you need any further examples. ###Comments __By Waylan on 9/11/09__ Joshua, thanks for the report. You are correct. It is a problem with the raw html code. If you were to do the following with your example we can see the problem more clearly: >>> md = markdown.Markdown() >>> print md.convert(code) <pre> class Test: hello = "world" def greet(self, name): print name </pre> >>> md.htmlStash.rawHtmlBlocks [(u'<pre>\nclass Test:\n hello = "world"\n\ndef greet(self, name):\n print name\n</pre>', False)] The first thing to note is that all of the block was inserted into the stash as a single block as it should (this is were most bugs have been). However, a single block should never alter anything within it -- which is happening here. We have at least one other outstanding ticket regarding the raw html processor and I've been kicking around some ideas for a refactor. Guess it's time to dig in. I should also point out that this used to work correct in 1.7. Not sure when we broke it, but the current testing framework won't even catch this bug because of some weird stuff it does with leading whitespace.
Reported by
Assigned to
Status
open
someday
resolved
closed
Resolution
n.a.
fixed
wontfix
Advanced Fields
Priority
unassigned
high
medium
low
Resolution Explanation
Component
Don't put anything here
Don't put anything here
Don't put anything here
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