blob: c729a3f2695ee8458cedaa983b07282fe6d87c10 [file] [log] [blame]
// Generated by CoffeeScript 1.6.3
(function() {
var XMLCData, XMLNode, _,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
_ = require('lodash-node');
XMLNode = require('./XMLNode');
module.exports = XMLCData = (function(_super) {
__extends(XMLCData, _super);
function XMLCData(parent, text) {
XMLCData.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing CDATA text");
}
this.text = this.stringify.cdata(text);
}
XMLCData.prototype.clone = function() {
return _.create(XMLCData.prototype, this);
};
XMLCData.prototype.toString = function(options, level) {
var indent, newline, pretty, r, space;
pretty = (options != null ? options.pretty : void 0) || false;
indent = (options != null ? options.indent : void 0) || ' ';
newline = (options != null ? options.newline : void 0) || '\n';
level || (level = 0);
space = new Array(level + 1).join(indent);
r = '';
if (pretty) {
r += space;
}
r += '<![CDATA[' + this.text + ']]>';
if (pretty) {
r += newline;
}
return r;
};
return XMLCData;
})(XMLNode);
}).call(this);