From: Brian Candler Date: 2010-01-08T22:04:33+09:00 Subject: Re: Stopping String Escaping. > You could simplify your code if you rewrote to use the block form of > gsub anyway. Try this: ----- 8< ------------------------------------------------- require 'rubygems' require 'uv' require 'redcloth' text = DATA.read text.gsub!(/#>code\((\S+)\)(.+?)#>code/m) do "" + Uv.parse($2, 'xhtml', $1, false, 'twilight') + "" end puts RedCloth.new(text).to_html __END__ h1. Some code #>code(ruby) puts "Hello world!\n" puts "Hello\\one backslash" #>code h1. The end ----- 8< ------------------------------------------------- Output:

Some code

puts "Hello 
world!\n"
puts "Hello\\one backslash"

The end

-- Posted via http://www.ruby-forum.com/.