const Compiler = require('./compiler'); /** * Compiles a @Text from text node. */ module.exports = new Class({ Extends: Compiler ,compile(builder, node, tagName) { if (tagName && tagName != 't') return null; const text = node.textContent; const context = {text}; if (tagName === 't') { context.text = _(node.firstChild.textContent); } else if (this.isExpr(text, true)) { context.text = ''; this.compileExpr(context, null, text, true); } return context; } ,instantiate(doc, context) { return doc.createTextNode(context.text); } ,setProperty(object, property, value) { object.textContent = value; } });