// Utilities for HTML manipulation. /* This encodes strings safely for HTML (unless it's going in a tag parameter, in which case you should use HTMLEncodeQuoted below.) */ HTMLEncode[line] := { if ! line return "" line = toString[line] line =~ %s/&/&/g; line =~ %s//>/g; return line } /* This encodes strings safely for HTML, including the case where it's going into a quoted tag parameter. This is usually always safer and better. */ HTMLEncodeQuoted[line] := { if ! line return "" line = toString[line] line = HTMLEncode[line]; line =~ %s/"/"/g; // line =~ %s/\\u/\\\\u/g; return line } // Make the tags for an HTML