Detailed documentation

evaluate()

Evaluates this template and returns an HtmlOutput object. Any properties set on this
HtmlTemplate object will be in scope when evaluating. To debug errors in a template,
examine the code using the getCode() method.

Return

getCode()

Generates a string of JavaScript code, based on the template file, that can be evaluated. This
method produces a string of JavaScript code based on the template file. Calling
eval(<code>) will return a new HtmlOutput object with the content of the
template after running all embedded server scripts. The generated code is intended to be
human-readable, and so if you need to debug a template you can call
Logger.log(<code>) to see what was produced.

Evaluating this code will implicitly bind in all variables in the current scope. In general,
it's preferable to use the evaluate() method, which takes explicit bindings.

Return

String — a string based on the template, which can be evaluated

getCodeWithComments()

Generates a string of JavaScript code that can be evaluated, with each line of the code
containing the original line from the template as a comment. This method produces a string of
JavaScript code based on the template file. Calling eval(<code>) will return
a new HtmlOutput object with the content of the template after running all embedded
server scripts. The generated code is intended to be human-readable, and so if you need to
debug a template you can call Logger.log(<code>) to see what was produced.

Evaluating this code will implicitly bind in all variables in the current scope. In general,
it's preferable to use the evaluate() method, which takes explicit bindings.