var className = this.declaredClass, _this = this;
// Cache contains a string because we need to do property replacement// do the property replacementreturn dojo.string.substitute(tmpl, this, function(value, key){if(key.charAt(0) == '!'){ value = _this[key.substr(1)]; }if(typeof value == "undefined"){thrownewError(className+" template:"+key); }// a debugging aideif(!value){return""; }// Substitution keys beginning with ! will skip the transform step,// in case a user wishes to insert unescaped markup, e.g. ${!foo}return key.charAt(0) == "!" ? value :
// Safer substitution, see heading "Attribute values" in// http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2
value.toString().replace(/"/g,"""); //TODO: add &? use encodeXML method?
}, this);