From: Brian Candler Date: 2010-01-08T07:26:01+09:00 Subject: Re: Stopping String Escaping. Phil Cooper-king wrote: > I am using Uv to for the syntax, which I pull out before sending to > redcloth > [code] > def snatch_code(text) > snippets = text.scan(/#>code\((\S+)\)(.+?)#>code/m) > > snippets.each do |snip| > code = Uv.parse(snip[1], 'xhtml', snip[0], false, 'twilight') > code.insert(0, "") > code.insert(code.length, "") > text.sub!(/#>code\((\S+)\)(.+?)#>code/m, code) > end > > text > end > [/code] OK, then what I suggest is you make a standalone test case, outside of Rails. source = <<'EOS' Put your sample source code here EOS # Print it to be sure it hasn't already been escaped by Ruby # Now process it with Uv # Show the intermediate state # Now process it with Redcloth # Show the final state Then you can see whether the problem is with Uv, or with Redcloth. Then the question becomes much more focussed - for example, it might be "how do I stop Redcloth turning \\ into \ inside a section?" -- Posted via http://www.ruby-forum.com/.