diff options
Diffstat (limited to 'node_modules/xmlbuilder/lib/XMLDeclaration.js')
-rw-r--r-- | node_modules/xmlbuilder/lib/XMLDeclaration.js | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/node_modules/xmlbuilder/lib/XMLDeclaration.js b/node_modules/xmlbuilder/lib/XMLDeclaration.js index c8f2c06c6..b50289247 100644 --- a/node_modules/xmlbuilder/lib/XMLDeclaration.js +++ b/node_modules/xmlbuilder/lib/XMLDeclaration.js @@ -1,10 +1,12 @@ -// Generated by CoffeeScript 1.10.0 +// Generated by CoffeeScript 1.9.1 (function() { - var XMLDeclaration, XMLNode, isObject, + var XMLDeclaration, XMLNode, create, isObject, extend = 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; }, hasProp = {}.hasOwnProperty; - isObject = require('./Utility').isObject; + create = require('lodash/create'); + + isObject = require('lodash/isObject'); XMLNode = require('./XMLNode'); @@ -29,8 +31,31 @@ } } - XMLDeclaration.prototype.toString = function(options) { - return this.options.writer.set(options).declaration(this); + XMLDeclaration.prototype.toString = function(options, level) { + var indent, newline, offset, pretty, r, ref, ref1, ref2, space; + pretty = (options != null ? options.pretty : void 0) || false; + indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; + offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; + newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; + level || (level = 0); + space = new Array(level + offset + 1).join(indent); + r = ''; + if (pretty) { + r += space; + } + r += '<?xml'; + r += ' version="' + this.version + '"'; + if (this.encoding != null) { + r += ' encoding="' + this.encoding + '"'; + } + if (this.standalone != null) { + r += ' standalone="' + this.standalone + '"'; + } + r += '?>'; + if (pretty) { + r += newline; + } + return r; }; return XMLDeclaration; |