[Nitro] Template compilation bug

James Britt james_b at neurogami.com
Thu Nov 17 00:11:30 EST 2005

Apologies f this was already reported, but it's the first I've seen it 
(I'm using Nitro 0.24 with Ruby 1.8.2 on Windows)

I was trying to create a simple Web page that took the contents of a 
text field and coped it over to a div as the user typed.

But I kept getting JavaScript errors.

My template has a javascript section with this code:

  function process( text ) {
    return( text.replace( /\n/, "\n\r" ) );

What ends up in the browser, though, is this:

function process( text ) {
       return( text.replace( /
/, "

" ) );


It seems that my newline and carriage-return text is being interpreted 
literally  by Nitro, instead of being passed though as-is.

I can work around this by sticking the script in an external file, but 
that should be required.




http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools

More information about the Nitro-general mailing list