It is very convenient to keep small HTML segments in your Ruby, rather than making a separate file. However, you should know this:
The WebDialog.set_html() writes your HTML into a temp file and hands the browser the URI of that file. During the file writing process, character substitution is performed. I'd call it a bug, not a feature. It means the string in this bit of script:
crlf = '\x0d\x0a';
is reduced to two characters, an unterminated string error at load time. This works:
crlf = String.fromCharCode( 13 ) + String.fromCharCode( 10 );
If you want a backslash in a regular expression, its probably best to put the HTML in its own file. This is from the console I'm working on:
# escape the backslashes;
pathname.gsub!( /\\/, "\\\\\\\\" ) # huh? dunno. experiment.