Ticket #56 (new defect)
Whitespace-sensitive tags don't properly parse
| Reported by: | elliottcable | Owned by: | why |
|---|---|---|---|
| Priority: | critical | Milestone: | |
| Component: | lib | Version: | 3.0.4 |
| Keywords: | Cc: |
Description
BlueCloth? exhibits the same problem, leaving us without a working solution. Take the following selection of markdown:
This is a paragraph of text.
<div>
This is another paragraph, inside a division.
#!/bin/bash
puts 'This is some code!
if (2 * 2) == 4
puts 'the universe makes sense'
else
puts 'the universe (or your ruby install...) has gone insane!'
end
Wasn't that some cool code?
</div>
This is a final paragraph of text, demonstrating that the previous code is, indeed, absolutely awesome!
The four lines in the middle should be, and are correctly, parsed as a <pre><code></*> block in Markdown. However, since they're <pre> blocks, they are whitespace sensitive - and RedCloth? leaves the four spaces of necessary indentation in after parsing, so you end up with this markup:
<p>This is a paragraph of text.</p>
<div>
<p>This is another paragraph, inside a division.</p>
<pre><code>#!/bin/bash
puts 'This is some code!
if (2 * 2) == 4
puts 'the universe makes sense'
else
puts 'the universe (or your ruby install...) has gone insane!'
end</code></pre>
<p>Wasn't that some cool code?</p>
</div>
<p>This is another paragraph of text, demonstrating that the previous code is, indeed, absolutely awesome!</p>
As you can see, the <pre> block is incorrectly indented, causing all but the first line of the block to have 6 spaces of extra indentation when displayed. This is how it *should* be parsed:
<p>This is a paragraph of text.</p>
<div>
<p>This is another paragraph, inside a division.</p>
<pre><code>#!/bin/bash
puts 'This is some code!
if (2 * 2) == 4
puts 'the universe makes sense'
else
puts 'the universe (or your ruby install...) has gone insane!'
end</code></pre>
<p>Wasn't that some cool code?</p>
</div>
<p>This is another paragraph of text, demonstrating that the previous code is, indeed, absolutely awesome!</p>
That is, anything after the first line of the code block should be completely out-dented from any indentation caused by it's position in the content, but retain any inherent indentation.