var Compiler = require ('./compiler'); /** * Compiles a @HTML.TextNode from text node. */ module.exports = new Class ({ Extends: Compiler ,compile: function (builder, node, tagName) { if (!tagName) { var text = node.textContent; if (/^\s*\\?[_|\\]/.test (text)) { var prefix = text.match (/^\s*/)[0]; var suffix = text.match (/\s*$/)[0]; text = text.trim (); text = prefix + this.translateValue(text) + suffix; } } else if (tagName === 't') var text = _(node.firstChild.textContent); else return null; return {text: text}; } ,instantiate: function (doc, context) { return doc.createTextNode (context.text); } });