[Nitro] PATCH: (2) template escape backslashes & RELEASES rdoc fix

Peter Abrahamsen rainhead at gmail.com
Wed Jan 4 04:48:44 EST 2006

Right, ok. Sorry to all for posting so clearly broken a patch.

I've been pouring over the pickaxe (which doesn't seem to mention the  
%^ delimiter), and staring at the screen for a while, but I still  
don't quite get what's going on. This stuff drives me batty.

George? Given that you already (theoretically) know how this stuff  
works, can you point the way?

Here's an updated set of tests. I moved some length calls out of the  
template text (duh), and added the case you suggested. Careful incase  
some part of this mail system wrapped some lines.

   def test_escapes
     # Don't treat backslashes specially.
     out = ''
     Template.process('foo\nbar', :out, binding)
     assert_equal(8, out.length, "Backslashes in template text are  
being treated as escapes.")

     # Don't escape newlines
     out = ''
     Template.process("foo\nbar", :out, binding)
     assert_equal(7, out.length, "Literal newlines in template text  
are being escaped.")

     out = ''
     Template.process(%q{<?r len = 'foo\nbar' ?>#{len}}, :out, binding)
     assert_equal(8, out.length, "Newline escapes in inline ruby are  
being treated incorrectly.")

     out = ''
     Template.process(%q{#{'foo\nbar'}}, :out, binding)
     assert_equal(8, out.length, "Newline escapes in interpolated  
ruby expressions are being treated incorrectly.")

     out = ''
     assert_nothing_raised("Backslashes escaped where they shouldn't  
be") {
       Template.process(%q{#{'foo/bar'.gsub(/\/bar$/, '')}}, :out,  

On Jan 3, 2006, at 11:34 PM, Bryan Soto wrote:

> #{glycerin}/nitro/proto/public/scaffold/edit.xhtml:5
> The line is: <a href="#{request.uri.gsub(/\/all$/, '')}">Show  
> editable</a>
> The patch is basically converting "/\/all$/" into "/\\/all$/"  
> quoting the backslash used as a quoting character thus causing the  
> syntax error.
> At the very least, it's a new test case. I'm not quite sure what to  
> do about it though...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2410 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060104/9abe9cd9/attachment.bin 

More information about the Nitro-general mailing list