Ruby Forum Redcloth > new failing test in trunk/test/code.yml

Posted by Stephen Bannasch (Guest)
on 23.03.2008 16:45
(Received via mailing list)
I've been playing with RedCloth-3.274 (great work Jason!) and found a
problem with processing of code content.

This:

Regex-based string substitution with Ruby\'s gsub!:
@"123<789".gsub!(/</, "") => "123789"@

Should produce:

<p>Regex-based string substitution with Ruby&#8217;s gsub!:
<code>123&lt;789".gsub!(/&lt;/, "") =&gt; "123789"</code></p>

But instead produces:

<p>Regex-based string substitution with Ruby&#8217;s gsub!:
<code>3&lt;789".gsub!(/&lt;/, "") =&gt; "123789"</code></p>

The "12" after the first double quote character in the code section are 
eaten.

I've got a question on the ragel-users list about how to compile
trunk ragel -- it seems to require ragel already installed to build
itself -- when I get that working I might be able to look into the
problem.

In the meantime here's a patch with a test that should fail.

Index: trunk/test/code.yml
===================================================================
--- trunk/test/code.yml  (revision 284)
+++ trunk/test/code.yml  (working copy)
@@ -7,6 +7,10 @@
  in: 'Please type @cat "file.txt" > otherfile.txt@ at the prompt.'
  html: '<p>Please type <code>cat "file.txt" &gt; otherfile.txt</code>
at the prompt.</p>'
  ---
+name: more inlne code escapement
+in: 'Regex-based string substitution with Ruby\'s gsub!:
@"123<789".gsub!(/</, "") => "123789"@'
+html: '<p>Regex-based string substitution with Ruby&#8217;s gsub!:
<code>123&lt;789".gsub!(/&lt;/, "") =&gt; "123789"</code></p>'
+---
  name: escaping in blockcode
  in: 'bc. This is within a block of code, so < and > should be
entities.  You can talk about a <p class="foo"> tag if you wish and
it will be properly escaped.'
  html: '<pre><code>This is within a block of code, so &lt; and &gt;
should be entities.  You can talk about a &lt;p class="foo"&gt; tag
if you wish and it will be properly escaped.</code></pre>'