[Greasemonkey] Long literal strings of html

Julien Couvreur julien.couvreur at gmail.com
Wed Apr 13 12:42:58 EDT 2005

I use that one a lot: putting single quotes inside double quoted
string and vice-versa.
Still, you need to put backslashes or "+ at the end of each line...

I like the "comments in function" solution, if it could work in Firefox...

Imagine something like ASP, JSP or PHP for user scripts:

function WriteSomeHtml() {
   var values = new Array();
  ... initialize values...
  return processTemplate(DATA1);

where DATA1 would be (with no escape sequence, except for a rare
keyword like __DATA__ or something similar):
__REQUIRES__ values array
<@ for (var i = 0; i < values.length; i++) { @>
<li><@ output(values[i]); @></li>
<@ } @>

The "processTemplate" and "output" methods would be provided by a
library or possible GM itself.


More information about the Greasemonkey mailing list