TemplatedDocument

a specialization of Document that: a) is always in strict mode and b) provides some template variable text replacement, in addition to DOM manips. The variable text is valid in text nodes and attribute values. It takes the format of {$variable}, where variable is a key into the vars member.

class TemplatedDocument : Document {
void delegate(TemplatedDocument)[] preToStringFilters;
void delegate(ref string)[] postToStringFilters;
}

Members

Variables

vars
string[string] vars;

use this to set up the string replacements. document.vars["name"] = "adam"; then in doc, <p>hellp, {$name}.</p>. Note the vars are converted lazily at toString time and are always HTML escaped.

viewFunctions
string delegate(string, string[], in Element, string)[string] viewFunctions;

In the html templates, you can write {$varname} or {$varname|func} (or {$varname|func arg arg|func} and so on). This holds the functions available these. The TemplatedDocument constructor puts in a handful of generic ones.

Meta