Replace all "&gt;"(>) which are inside <code> tags

Posted by Micke on Stack Overflow See other posts from Stack Overflow or by Micke
Published on 2010-06-06T11:04:37Z Indexed on 2010/06/06 11:12 UTC
Read the original article Hit count: 553

Filed under:
|

How can i replace all &gt; with > and &lt; with < inside a <code> tag with ruby?

For example: <code>&lt;script&gt;alert('I steal cookies');&lt;/script&gt;</code>

With: <code><script>alert('I steal cookies);<script><code>

The reason for this is because the h() method escapes all the < and >

Thanks, Micke

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby