[Nitro] transform_template -> block

Peter Abrahamsen rainhead at gmail.com
Tue Dec 27 16:37:38 EST 2005

> not one big string, a series of
> @out << "..."
> instructions plus ruby code.

Right, but it's actually a string that looks like:
"@out << #{the template text}"

Somehow in creating that final string, literal newlines in the  
template text are turned into \n's, but existing \n's are not given a  
further level of escapes. When the string is prepared to be given to  
the UA, there is no differentiation between the original newlines and  
the escaped ones--both are simple \n's.

The stopgap solution is to escape \'s just before the return  
instruction, after all the template transforms. I think that'd work  
for my purposes, but I don't know what kind of havoc it'd wreak on  
embedded ruby.

> This gets compiled as a method.
> why is this bad?

See my reply to TRANS. I have a little more time now, post-Christmas,  
so I'll look some more at this--and at the exciting new javascript  
stuff :)


More information about the Nitro-general mailing list