xmlbuilder
Advanced tools
Comparing version 5.0.1 to 6.0.0
# Change Log | ||
All notable changes to this project are documented in this file. This project adheres to [Semantic Versioning](http://semver.org/#semantic-versioning-200). | ||
## [5.0.1] - 2016-03-08 | ||
- Moved require statements for text case conversion to the top of files to reduce lazy requires. | ||
## [5.0.0] - 2016-03-05 | ||
@@ -42,3 +47,3 @@ - Added text case option for element names and attribute names. Valid cases are `lower`, `upper`, `camel`, `kebab` and `snake`. | ||
- Use native `isArray` instead of lodash. | ||
- Indentation of processing intructions are set to the parent element's. | ||
- Indentation of processing instructions are set to the parent element's. | ||
@@ -80,6 +85,6 @@ ## [2.6.4] - 2015-05-27 | ||
- Fixed bug in XMLStringifier where an undefined value was used while reporting an invalid encoding value. | ||
- Moved require statements to the top of files to reduce CPU usage from lazy requires. See [#62](https://github.com/oozcitak/xmlbuilder-js/issues/62). | ||
- Moved require statements to the top of files to reduce lazy requires. See [#62](https://github.com/oozcitak/xmlbuilder-js/issues/62). | ||
## [2.4.4] - 2014-09-08 | ||
- Added the `offset` option to `toSTring()` for use in XML fragments. | ||
- Added the `offset` option to `toString()` for use in XML fragments. | ||
@@ -97,3 +102,3 @@ ## [2.4.3] - 2014-08-13 | ||
- Correct cases of pubID and sysID. | ||
- Use single lodash instead of seperate npm modules. See [#53](https://github.com/oozcitak/xmlbuilder-js/issues/53). | ||
- Use single lodash instead of separate npm modules. See [#53](https://github.com/oozcitak/xmlbuilder-js/issues/53). | ||
- Escape according to Canonical XML 1.0. See [#54](https://github.com/oozcitak/xmlbuilder-js/issues/54). | ||
@@ -226,3 +231,3 @@ | ||
- Fixed `u()` function so that it now correctly calls `up()`. | ||
- Fixed typo in `element()` so that `attributes` and `text` van be passes interchangeably. | ||
- Fixed typo in `element()` so that `attributes` and `text` can be passed interchangeably. | ||
@@ -271,2 +276,4 @@ ## [0.1.2] - 2011-06-03 | ||
[5.0.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v5.0.0...v5.0.1 | ||
[5.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v4.2.1...v5.0.0 | ||
@@ -273,0 +280,0 @@ [4.2.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v4.2.0...v4.2.1 |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var XMLBuilder, assign; | ||
var XMLBuilder, XMLStreamWriter, XMLStringWriter, assign; | ||
@@ -9,2 +9,6 @@ assign = require('lodash/assign'); | ||
XMLStringWriter = require('./XMLStringWriter'); | ||
XMLStreamWriter = require('./XMLStreamWriter'); | ||
module.exports.create = function(name, xmldec, doctype, options) { | ||
@@ -15,2 +19,10 @@ options = assign({}, xmldec, doctype, options); | ||
module.exports.stringWriter = function(options) { | ||
return new XMLStringWriter(options); | ||
}; | ||
module.exports.streamWriter = function(stream, options) { | ||
return new XMLStreamWriter(stream, options); | ||
}; | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -9,2 +9,3 @@ var XMLAttribute, create; | ||
function XMLAttribute(parent, name, value) { | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
@@ -25,4 +26,4 @@ if (name == null) { | ||
XMLAttribute.prototype.toString = function(options, level) { | ||
return ' ' + this.name + '="' + this.value + '"'; | ||
XMLAttribute.prototype.toString = function(options) { | ||
return this.options.writer.set(options).attribute(this); | ||
}; | ||
@@ -29,0 +30,0 @@ |
@@ -1,13 +0,13 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var XMLBuilder, XMLDeclaration, XMLDocType, XMLElement, XMLStringifier; | ||
var XMLBuilder, XMLElement, XMLStringWriter, XMLStringifier, isPlainObject; | ||
isPlainObject = require('lodash/isPlainObject'); | ||
XMLStringifier = require('./XMLStringifier'); | ||
XMLDeclaration = require('./XMLDeclaration'); | ||
XMLElement = require('./XMLElement'); | ||
XMLDocType = require('./XMLDocType'); | ||
XMLStringWriter = require('./XMLStringWriter'); | ||
XMLElement = require('./XMLElement'); | ||
module.exports = XMLBuilder = (function() { | ||
@@ -22,2 +22,5 @@ function XMLBuilder(name, options) { | ||
} | ||
if (!options.writer) { | ||
options.writer = new XMLStringWriter(); | ||
} | ||
this.options = options; | ||
@@ -38,2 +41,10 @@ this.stringify = new XMLStringifier(options); | ||
XMLBuilder.prototype.dec = function() { | ||
return this.xmldec; | ||
}; | ||
XMLBuilder.prototype.dtd = function() { | ||
return this.doctype; | ||
}; | ||
XMLBuilder.prototype.root = function() { | ||
@@ -43,24 +54,15 @@ return this.rootObject; | ||
XMLBuilder.prototype.end = function(options) { | ||
return this.toString(options); | ||
XMLBuilder.prototype.end = function(writer) { | ||
var writerOptions; | ||
if (!writer) { | ||
writer = this.options.writer; | ||
} else if (isPlainObject(writer)) { | ||
writerOptions = writer; | ||
writer = this.options.writer.set(writerOptions); | ||
} | ||
return writer.document(this); | ||
}; | ||
XMLBuilder.prototype.toString = function(options) { | ||
var indent, newline, offset, pretty, r, ref, ref1, ref2; | ||
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'; | ||
r = ''; | ||
if (this.xmldec != null) { | ||
r += this.xmldec.toString(options); | ||
} | ||
if (this.doctype != null) { | ||
r += this.doctype.toString(options); | ||
} | ||
r += this.rootObject.toString(options); | ||
if (pretty && r.slice(-newline.length) === newline) { | ||
r = r.slice(0, -newline.length); | ||
} | ||
return r; | ||
return this.options.writer.set(options).document(this); | ||
}; | ||
@@ -67,0 +69,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -26,19 +26,4 @@ var XMLCData, XMLNode, create, | ||
XMLCData.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 += '<![CDATA[' + this.text + ']]>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLCData.prototype.toString = function(options) { | ||
return this.options.writer.set(options).cdata(this); | ||
}; | ||
@@ -45,0 +30,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -26,19 +26,4 @@ var XMLComment, XMLNode, create, | ||
XMLComment.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 += '<!-- ' + this.text + ' -->'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLComment.prototype.toString = function(options) { | ||
return this.options.writer.set(options).comment(this); | ||
}; | ||
@@ -45,0 +30,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -34,27 +34,4 @@ var XMLDeclaration, XMLNode, create, isObject, | ||
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; | ||
XMLDeclaration.prototype.toString = function(options) { | ||
return this.options.writer.set(options).declaration(this); | ||
}; | ||
@@ -61,0 +38,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -27,3 +27,4 @@ var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLProcessingInstruction, create, isObject; | ||
this.documentObject = parent; | ||
this.stringify = this.documentObject.stringify; | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
this.children = []; | ||
@@ -108,39 +109,10 @@ if (isObject(pubID)) { | ||
XMLDocType.prototype.toString = function(options, level) { | ||
var child, i, indent, len, newline, offset, pretty, r, ref, ref1, ref2, ref3, 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 += '<!DOCTYPE ' + this.root().name; | ||
if (this.pubID && this.sysID) { | ||
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; | ||
} else if (this.sysID) { | ||
r += ' SYSTEM "' + this.sysID + '"'; | ||
} | ||
if (this.children.length > 0) { | ||
r += ' ['; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
ref3 = this.children; | ||
for (i = 0, len = ref3.length; i < len; i++) { | ||
child = ref3[i]; | ||
r += child.toString(options, level + 1); | ||
} | ||
r += ']'; | ||
} | ||
r += '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLDocType.prototype.end = function(options) { | ||
return this.document().end(options); | ||
}; | ||
XMLDocType.prototype.toString = function(options) { | ||
return this.options.writer.set(options).docType(this); | ||
}; | ||
XMLDocType.prototype.ele = function(name, value) { | ||
@@ -147,0 +119,0 @@ return this.element(name, value); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -9,2 +9,3 @@ var XMLDTDAttList, create; | ||
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
@@ -39,26 +40,4 @@ if (elementName == null) { | ||
XMLDTDAttList.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 += '<!ATTLIST ' + this.elementName + ' ' + this.attributeName + ' ' + this.attributeType; | ||
if (this.defaultValueType !== '#DEFAULT') { | ||
r += ' ' + this.defaultValueType; | ||
} | ||
if (this.defaultValue) { | ||
r += ' "' + this.defaultValue + '"'; | ||
} | ||
r += '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLDTDAttList.prototype.toString = function(options) { | ||
return this.options.writer.set(options).dtdAttList(this); | ||
}; | ||
@@ -65,0 +44,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -9,2 +9,3 @@ var XMLDTDElement, create; | ||
function XMLDTDElement(parent, name, value) { | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
@@ -24,19 +25,4 @@ if (name == null) { | ||
XMLDTDElement.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 += '<!ELEMENT ' + this.name + ' ' + this.value + '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLDTDElement.prototype.toString = function(options) { | ||
return this.options.writer.set(options).dtdElement(this); | ||
}; | ||
@@ -43,0 +29,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -11,2 +11,3 @@ var XMLDTDEntity, create, isObject; | ||
function XMLDTDEntity(parent, pe, name, value) { | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
@@ -45,36 +46,4 @@ if (name == null) { | ||
XMLDTDEntity.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 += '<!ENTITY'; | ||
if (this.pe) { | ||
r += ' %'; | ||
} | ||
r += ' ' + this.name; | ||
if (this.value) { | ||
r += ' "' + this.value + '"'; | ||
} else { | ||
if (this.pubID && this.sysID) { | ||
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; | ||
} else if (this.sysID) { | ||
r += ' SYSTEM "' + this.sysID + '"'; | ||
} | ||
if (this.nData) { | ||
r += ' NDATA ' + this.nData; | ||
} | ||
} | ||
r += '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLDTDEntity.prototype.toString = function(options) { | ||
return this.options.writer.set(options).dtdEntity(this); | ||
}; | ||
@@ -81,0 +50,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -9,2 +9,3 @@ var XMLDTDNotation, create; | ||
function XMLDTDNotation(parent, name, value) { | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
@@ -26,27 +27,4 @@ if (name == null) { | ||
XMLDTDNotation.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 += '<!NOTATION ' + this.name; | ||
if (this.pubID && this.sysID) { | ||
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; | ||
} else if (this.pubID) { | ||
r += ' PUBLIC "' + this.pubID + '"'; | ||
} else if (this.sysID) { | ||
r += ' SYSTEM "' + this.sysID + '"'; | ||
} | ||
r += '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLDTDNotation.prototype.toString = function(options) { | ||
return this.options.writer.set(options).dtdNotation(this); | ||
}; | ||
@@ -53,0 +31,0 @@ |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var XMLAttribute, XMLElement, XMLNode, XMLProcessingInstruction, create, every, isFunction, isObject, | ||
var XMLAttribute, XMLElement, XMLNode, XMLProcessingInstruction, create, isFunction, 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; }, | ||
@@ -13,4 +13,2 @@ hasProp = {}.hasOwnProperty; | ||
every = require('lodash/every'); | ||
XMLNode = require('./XMLNode'); | ||
@@ -136,62 +134,4 @@ | ||
XMLElement.prototype.toString = function(options, level) { | ||
var allowEmpty, att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, ref6, 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'; | ||
allowEmpty = (ref3 = options != null ? options.allowEmpty : void 0) != null ? ref3 : false; | ||
level || (level = 0); | ||
space = new Array(level + offset + 1).join(indent); | ||
r = ''; | ||
ref4 = this.instructions; | ||
for (i = 0, len = ref4.length; i < len; i++) { | ||
instruction = ref4[i]; | ||
r += instruction.toString(options, level); | ||
} | ||
if (pretty) { | ||
r += space; | ||
} | ||
r += '<' + this.name; | ||
ref5 = this.attributes; | ||
for (name in ref5) { | ||
if (!hasProp.call(ref5, name)) continue; | ||
att = ref5[name]; | ||
r += att.toString(options); | ||
} | ||
if (this.children.length === 0 || every(this.children, function(e) { | ||
return e.value === ''; | ||
})) { | ||
if (allowEmpty) { | ||
r += '></' + this.name + '>'; | ||
} else { | ||
r += '/>'; | ||
} | ||
if (pretty) { | ||
r += newline; | ||
} | ||
} else if (pretty && this.children.length === 1 && (this.children[0].value != null)) { | ||
r += '>'; | ||
r += this.children[0].value; | ||
r += '</' + this.name + '>'; | ||
r += newline; | ||
} else { | ||
r += '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
ref6 = this.children; | ||
for (j = 0, len1 = ref6.length; j < len1; j++) { | ||
child = ref6[j]; | ||
r += child.toString(options, level + 1); | ||
} | ||
if (pretty) { | ||
r += space; | ||
} | ||
r += '</' + this.name + '>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
} | ||
return r; | ||
XMLElement.prototype.toString = function(options) { | ||
return this.options.writer.set(options).element(this); | ||
}; | ||
@@ -198,0 +138,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -231,3 +231,3 @@ var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLRaw, XMLText, isEmpty, isFunction, isObject, | ||
XMLNode.prototype.end = function(options) { | ||
return this.document().toString(options); | ||
return this.document().end(options); | ||
}; | ||
@@ -234,0 +234,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -9,2 +9,3 @@ var XMLProcessingInstruction, create; | ||
function XMLProcessingInstruction(parent, target, value) { | ||
this.options = parent.options; | ||
this.stringify = parent.stringify; | ||
@@ -24,24 +25,4 @@ if (target == null) { | ||
XMLProcessingInstruction.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 += '<?'; | ||
r += this.target; | ||
if (this.value) { | ||
r += ' ' + this.value; | ||
} | ||
r += '?>'; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLProcessingInstruction.prototype.toString = function(options) { | ||
return this.options.writer.set(options).processingInstruction(this); | ||
}; | ||
@@ -48,0 +29,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -26,19 +26,4 @@ var XMLNode, XMLRaw, create, | ||
XMLRaw.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 += this.value; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLRaw.prototype.toString = function(options) { | ||
return this.options.writer.set(options).raw(this); | ||
}; | ||
@@ -45,0 +30,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -17,6 +17,9 @@ var XMLStringifier, camelCase, kebabCase, snakeCase, | ||
var key, ref, value; | ||
this.allowSurrogateChars = options != null ? options.allowSurrogateChars : void 0; | ||
this.noDoubleEncoding = options != null ? options.noDoubleEncoding : void 0; | ||
this.textCase = options != null ? options.textCase : void 0; | ||
ref = (options != null ? options.stringify : void 0) || {}; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
this.allowSurrogateChars = options.allowSurrogateChars; | ||
this.noDoubleEncoding = options.noDoubleEncoding; | ||
this.textCase = options.textCase; | ||
ref = options.stringify || {}; | ||
for (key in ref) { | ||
@@ -23,0 +26,0 @@ if (!hasProp.call(ref, key)) continue; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -26,19 +26,4 @@ var XMLNode, XMLText, create, | ||
XMLText.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 += this.value; | ||
if (pretty) { | ||
r += newline; | ||
} | ||
return r; | ||
XMLText.prototype.toString = function(options) { | ||
return this.options.writer.set(options).text(this); | ||
}; | ||
@@ -45,0 +30,0 @@ |
{ | ||
"name": "xmlbuilder", | ||
"version": "5.0.1", | ||
"version": "6.0.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "xml", |
78268
25
1613