1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-03 21:00:04 +02:00

remove electron-in-page-search

This commit is contained in:
s2
2019-06-06 15:44:24 +02:00
parent e2a57318a7
commit c5f9b551ab
92637 changed files with 636010 additions and 15 deletions

4
app/node_modules/plist/.jshintrc generated vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"laxbreak": true,
"laxcomma": true
}

43
app/node_modules/plist/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,43 @@
sudo: false
language: node_js
node_js:
- '0.10'
- '0.12'
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
env:
global:
- secure: xlLmWO7akYQjmDgrv6/b/ZMGILF8FReD+k6A/u8pYRD2JW29hhwvRwIQGcKp9+zmJdn4i5M4D1/qJkCeI3pdhAYBDHvzHOHSEwLJz1ESB2Crv6fa69CtpIufQkWvIxmZoU49tCaLpMBaIroGihJ4DAXdIVOIz6Ur9vXLDhGsE4c=
- secure: aQ46RdxL10xR5ZJJTMUKdH5k4tdrzgZ87nlwHC+pTr6bfRw3UKYC+6Rm7yQpg9wq0Io9O9dYCP007gQGSWstbjr1+jXNu/ubtNG+q5cpWBQZZZ013VHh9QJTf1MnetsZxbv8Yhrjg590s6vruT0oqesOnB2CizO/BsKxnY37Nos=
matrix:
include:
- node_js: '0.10'
env: BROWSER_NAME=chrome BROWSER_VERSION=latest
- node_js: '0.10'
env: BROWSER_NAME=chrome BROWSER_VERSION=29
- node_js: '0.10'
env: BROWSER_NAME=firefox BROWSER_VERSION=latest
- node_js: '0.10'
env: BROWSER_NAME=opera BROWSER_VERSION=latest
- node_js: '0.10'
env: BROWSER_NAME=safari BROWSER_VERSION=latest
- node_js: '0.10'
env: BROWSER_NAME=safari BROWSER_VERSION=7
- node_js: '0.10'
env: BROWSER_NAME=safari BROWSER_VERSION=6
- node_js: '0.10'
env: BROWSER_NAME=safari BROWSER_VERSION=5
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=11
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=10
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=9

149
app/node_modules/plist/History.md generated vendored Normal file
View File

@@ -0,0 +1,149 @@
2.1.0 / 2017-05-04
==================
* [[`e4f06669bb`]](https://github.com/TooTallNate/plist.js/commit/e4f06669bb51d2e65654df7c39aab52bc3bf4e8a) - update license (extend copyright term) (Mike Reinstein)
* [[`edc6e41035`]](https://github.com/TooTallNate/plist.js/commit/edc6e4103546b1d7518a577e7c202c305a8abec0) - update module deps (Mike Reinstein)
* [[`85d11c48ef`](https://github.com/TooTallNate/plist.js/commit/85d11c48eff02312cbdd67f46fd8e74b0d372ca1)] - Harden test-cases and implementation to align with other implementations (Björn Brauer)
* [[`7619537eaa`]](https://github.com/TooTallNate/plist.js/commit/7619537eaa9e3e5a80829e759c004d2e017a07d2) review feedback: early returns and constants for nodeTypes (Björn Brauer)
2.0.1 / 2016-08-16
==================
* [[`de136c8388`](https://github.com/TooTallNate/plist/commit/de136c8388)] - bad npm release… (Nathan Rajlich)
2.0.0 / 2016-08-16
==================
* [[`90deef5d43`](https://github.com/TooTallNate/plist/commit/90deef5d43)] - remove deprecated functions (Nathan Rajlich)
* [[`d475cd8ce9`](https://github.com/TooTallNate/plist/commit/d475cd8ce9)] - Added travis ci support for node 6 (Amila Welihinda)
* [[`04c8ee7646`](https://github.com/TooTallNate/plist/commit/04c8ee7646)] - update dependencies (Mitchell Hentges)
* [[`97c02b3f05`](https://github.com/TooTallNate/plist/commit/97c02b3f05)] - **travis**: add `sudo: false` and test more node versions (Nathan Rajlich)
* [[`54c821ec29`](https://github.com/TooTallNate/plist/commit/54c821ec29)] - #71 - fixed and added test (Andrew Goldis)
* [[`4afb7c5079`](https://github.com/TooTallNate/plist/commit/4afb7c5079)] - fix `Cannot read property 'nodeValue' of undefined exception` that is thrown when a `<key></key>` construct appears in plist (Chris Kinsman)
* [[`f360d7d685`](https://github.com/TooTallNate/plist/commit/f360d7d685)] - #66 - fixed empty keys and added tests (Andrew Goldis)
* [[`421c7f26e9`](https://github.com/TooTallNate/plist/commit/421c7f26e9)] - #66 - fixed empty key (Andrew Goldis)
* [[`a88aa4dca7`](https://github.com/TooTallNate/plist/commit/a88aa4dca7)] - add verbose examples (mrzmyr)
1.2.0 / 2015-11-10
==================
* package: update "browserify" to v12.0.1
* package: update "zuul" to v3.7.2
* package: update "xmlbuilder" to v4.0.0
* package: update "util-deprecate" to v1.0.2
* package: update "mocha" to v2.3.3
* package: update "base64-js" to v0.0.8
* build: omit undefined values
* travis: add node 4.0 and 4.1 to test matrix
1.1.0 / 2014-08-27
==================
* package: update "browserify" to v5.10.1
* package: update "zuul" to v1.10.2
* README: add "Sauce Test Status" build badge
* travis: use new "plistjs" sauce credentials
* travis: set up zuul saucelabs automated testing
1.0.1 / 2014-06-25
==================
* add .zuul.yml file for browser testing
* remove Testling stuff
* build: fix global variable `val` leak
* package: use --check-leaks when running mocha tests
* README: update examples to use preferred API
* package: add "browser" keyword
1.0.0 / 2014-05-20
==================
* package: remove "android-browser"
* test: add <dict> build() test
* test: re-add the empty string build() test
* test: remove "fixtures" and legacy "tests" dir
* test: add some more build() tests
* test: add a parse() CDATA test
* test: starting on build() tests
* test: more parse() tests
* package: attempt to fix "android-browser" testling
* parse: better <data> with newline handling
* README: add Testling badge
* test: add <data> node tests
* test: add a <date> parse() test
* travis: don't test node v0.6 or v0.8
* test: some more parse() tests
* test: add simple <string> parsing test
* build: add support for an optional "opts" object
* package: test mobile devices
* test: use multiline to inline the XML
* package: beautify
* package: fix "mocha" harness
* package: more testling browsers
* build: add the "version=1.0" attribute
* beginnings of "mocha" tests
* build: more JSDocs
* tests: add test that ensures that empty string conversion works
* build: update "xmlbuilder" to v2.2.1
* parse: ignore comment and cdata nodes
* tests: make the "Newlines" test actually contain a newline
* parse: lint
* test travis
* README: add Travis CI badge
* add .travis.yml file
* build: updated DTD to reflect name change
* parse: return falsey values in an Array plist
* build: fix encoding a typed array in the browser
* build: add support for Typed Arrays and ArrayBuffers
* build: more lint
* build: slight cleanup and optimizations
* build: use .txt() for the "date" value
* parse: always return a Buffer for <data> nodes
* build: don't interpret Strings as base64
* dist: commit prebuilt plist*.js files
* parse: fix typo in deprecate message
* parse: fix parse() return value
* parse: add jsdoc comments for the deprecated APIs
* parse: add `parse()` function
* node, parse: use `util-deprecate` module
* re-implemented parseFile to be asynchronous
* node: fix jsdoc comment
* Makefile: fix "node" require stubbing
* examples: add "browser" example
* package: tweak "main"
* package: remove "engines" field
* Makefile: fix --exclude command for browserify
* package: update "description"
* lib: more styling
* Makefile: add -build.js and -parse.js dist files
* lib: separate out the parse and build logic into their own files
* Makefile: add makefile with browserify build rules
* package: add "browserify" as a dev dependency
* plist: tabs to spaces (again)
* add a .jshintrc file
* LICENSE: update
* node-webkit support
* Ignore tests/ in .npmignore file
* Remove duplicate devDependencies key
* Remove trailing whitespace
* adding recent contributors. Bumping npm package number (patch release)
* Fixed node.js string handling
* bumping version number
* Fixed global variable plist leak
* patch release 0.4.1
* removed temporary debug output file
* flipping the cases for writing data and string elements in build(). removed the 125 length check. Added validation of base64 encoding for data fields when parsing. added unit tests.
* fixed syntax errors in README examples (issue #20)
* added Sync versions of calls. added deprecation warnings for old method calls. updated documentation. If the resulting object from parseStringSync is an array with 1 element, return just the element. If a plist string or file doesnt have a <plist> tag as the document root element, fail noisily (issue #15)
* incrementing package version
* added cross platform base64 encode/decode for data elements (issue #17.) Comments and hygiene.
* refactored the code to use a DOM parser instead of SAX. closes issues #5 and #16
* rolling up package version
* updated base64 detection regexp. updated README. hygiene.
* refactored the build function. Fixes issue #14
* refactored tests. Modified tests from issue #9. thanks @sylvinus
* upgrade xmlbuilder package version. this is why .end() was needed in last commit; breaking change to xmlbuilder lib. :/
* bug fix in build function, forgot to call .end() Refactored tests to use nodeunit
* Implemented support for real, identity tests
* Refactored base64 detection - still sloppy, fixed date building. Passing tests OK.
* Implemented basic plist builder that turns an existing JS object into plist XML. date, real and data types still need to be implemented.

24
app/node_modules/plist/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2010-2017 Nathan Rajlich <nathan@tootallnate.net>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

76
app/node_modules/plist/Makefile generated vendored Normal file
View File

@@ -0,0 +1,76 @@
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
# BIN directory
BIN := $(THIS_DIR)/node_modules/.bin
# applications
NODE ?= node
NPM ?= $(NODE) $(shell which npm)
BROWSERIFY ?= $(NODE) $(BIN)/browserify
MOCHA ?= $(NODE) $(BIN)/mocha
ZUUL ?= $(NODE) $(BIN)/zuul
REPORTER ?= spec
all: dist/plist.js dist/plist-build.js dist/plist-parse.js
install: node_modules
clean:
@rm -rf node_modules dist
dist:
@mkdir -p $@
dist/plist-build.js: node_modules lib/build.js dist
@$(BROWSERIFY) \
--standalone plist \
lib/build.js > $@
dist/plist-parse.js: node_modules lib/parse.js dist
@$(BROWSERIFY) \
--standalone plist \
lib/parse.js > $@
dist/plist.js: node_modules lib/*.js dist
@$(BROWSERIFY) \
--standalone plist \
--ignore lib/node.js \
lib/plist.js > $@
node_modules: package.json
@NODE_ENV= $(NPM) install
@touch node_modules
test:
@if [ "x$(BROWSER_NAME)" = "x" ]; then \
$(MAKE) test-node; \
else \
$(MAKE) test-zuul; \
fi
test-node:
@$(MOCHA) \
--reporter $(REPORTER) \
test/*.js
test-zuul:
@if [ "x$(BROWSER_PLATFORM)" = "x" ]; then \
$(ZUUL) \
--ui mocha-bdd \
--browser-name $(BROWSER_NAME) \
--browser-version $(BROWSER_VERSION) \
test/*.js; \
else \
$(ZUUL) \
--ui mocha-bdd \
--browser-name $(BROWSER_NAME) \
--browser-version $(BROWSER_VERSION) \
--browser-platform "$(BROWSER_PLATFORM)" \
test/*.js; \
fi
.PHONY: all install clean test test-node test-zuul

141
app/node_modules/plist/README.md generated vendored Normal file
View File

@@ -0,0 +1,141 @@
plist.js
========
### Mac OS X Plist parser/builder for Node.js and browsers
[![Sauce Test Status](https://saucelabs.com/browser-matrix/plistjs.svg)](https://saucelabs.com/u/plistjs)
[![Build Status](https://travis-ci.org/TooTallNate/plist.js.svg?branch=master)](https://travis-ci.org/TooTallNate/plist.js)
Provides facilities for reading and writing Mac OS X Plist (property list)
files. These are often used in programming OS X and iOS applications, as
well as the iTunes configuration XML file.
Plist files represent stored programming "object"s. They are very similar
to JSON. A valid Plist file is representable as a native JavaScript Object
and vice-versa.
## Usage
### Node.js
Install using `npm`:
``` bash
$ npm install --save plist
```
Then `require()` the _plist_ module in your file:
``` js
var plist = require('plist');
// now use the `parse()` and `build()` functions
var val = plist.parse('<plist><string>Hello World!</string></plist>');
console.log(val); // "Hello World!"
```
### Browser
Include the `dist/plist.js` in a `<script>` tag in your HTML file:
``` html
<script src="plist.js"></script>
<script>
// now use the `parse()` and `build()` functions
var val = plist.parse('<plist><string>Hello World!</string></plist>');
console.log(val); // "Hello World!"
</script>
```
## API
### Parsing
Parsing a plist from filename:
``` javascript
var fs = require('fs');
var plist = require('plist');
var obj = plist.parse(fs.readFileSync('myPlist.plist', 'utf8'));
console.log(JSON.stringify(obj));
```
Parsing a plist from string payload:
``` javascript
var plist = require('plist');
var xml =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' +
'<plist version="1.0">' +
'<key>metadata</key>' +
'<dict>' +
'<key>bundle-identifier</key>' +
'<string>com.company.app</string>' +
'<key>bundle-version</key>' +
'<string>0.1.1</string>' +
'<key>kind</key>' +
'<string>software</string>' +
'<key>title</key>' +
'<string>AppName</string>' +
'</dict>' +
'</plist>';
console.log(plist.parse(xml));
// [
// "metadata",
// {
// "bundle-identifier": "com.company.app",
// "bundle-version": "0.1.1",
// "kind": "software",
// "title": "AppName"
// }
// ]
```
### Building
Given an existing JavaScript Object, you can turn it into an XML document
that complies with the plist DTD:
``` javascript
var plist = require('plist');
var json = [
"metadata",
{
"bundle-identifier": "com.company.app",
"bundle-version": "0.1.1",
"kind": "software",
"title": "AppName"
}
];
console.log(plist.build(json));
// <?xml version="1.0" encoding="UTF-8"?>
// <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
// <plist version="1.0">
// <key>metadata</key>
// <dict>
// <key>bundle-identifier</key>
// <string>com.company.app</string>
// <key>bundle-version</key>
// <string>0.1.1</string>
// <key>kind</key>
// <string>software</string>
// <key>title</key>
// <string>AppName</string>
// </dict>
// </plist>
```
## License
[(The MIT License)](LICENSE)

14
app/node_modules/plist/examples/browser/index.html generated vendored Normal file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>plist.js browser example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<script src="../../dist/plist.js"></script>
<script>
// TODO: add <input type=file> drag and drop example
console.log(plist);
</script>
</body>
</html>

13
app/node_modules/plist/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* Parser functions.
*/
var parserFunctions = require('./lib/parse');
Object.keys(parserFunctions).forEach(function (k) { exports[k] = parserFunctions[k]; });
/**
* Builder functions.
*/
var builderFunctions = require('./lib/build');
Object.keys(builderFunctions).forEach(function (k) { exports[k] = builderFunctions[k]; });

137
app/node_modules/plist/lib/build.js generated vendored Normal file
View File

@@ -0,0 +1,137 @@
/**
* Module dependencies.
*/
var base64 = require('base64-js');
var xmlbuilder = require('xmlbuilder');
/**
* Module exports.
*/
exports.build = build;
/**
* Accepts a `Date` instance and returns an ISO date string.
*
* @param {Date} d - Date instance to serialize
* @returns {String} ISO date string representation of `d`
* @api private
*/
function ISODateString(d){
function pad(n){
return n < 10 ? '0' + n : n;
}
return d.getUTCFullYear()+'-'
+ pad(d.getUTCMonth()+1)+'-'
+ pad(d.getUTCDate())+'T'
+ pad(d.getUTCHours())+':'
+ pad(d.getUTCMinutes())+':'
+ pad(d.getUTCSeconds())+'Z';
}
/**
* Returns the internal "type" of `obj` via the
* `Object.prototype.toString()` trick.
*
* @param {Mixed} obj - any value
* @returns {String} the internal "type" name
* @api private
*/
var toString = Object.prototype.toString;
function type (obj) {
var m = toString.call(obj).match(/\[object (.*)\]/);
return m ? m[1] : m;
}
/**
* Generate an XML plist string from the input object `obj`.
*
* @param {Object} obj - the object to convert
* @param {Object} [opts] - optional options object
* @returns {String} converted plist XML string
* @api public
*/
function build (obj, opts) {
var XMLHDR = {
version: '1.0',
encoding: 'UTF-8'
};
var XMLDTD = {
pubid: '-//Apple//DTD PLIST 1.0//EN',
sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
};
var doc = xmlbuilder.create('plist');
doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone);
doc.dtd(XMLDTD.pubid, XMLDTD.sysid);
doc.att('version', '1.0');
walk_obj(obj, doc);
if (!opts) opts = {};
// default `pretty` to `true`
opts.pretty = opts.pretty !== false;
return doc.end(opts);
}
/**
* depth first, recursive traversal of a javascript object. when complete,
* next_child contains a reference to the build XML object.
*
* @api private
*/
function walk_obj(next, next_child) {
var tag_type, i, prop;
var name = type(next);
if ('Undefined' == name) {
return;
} else if (Array.isArray(next)) {
next_child = next_child.ele('array');
for (i = 0; i < next.length; i++) {
walk_obj(next[i], next_child);
}
} else if (Buffer.isBuffer(next)) {
next_child.ele('data').raw(next.toString('base64'));
} else if ('Object' == name) {
next_child = next_child.ele('dict');
for (prop in next) {
if (next.hasOwnProperty(prop)) {
next_child.ele('key').txt(prop);
walk_obj(next[prop], next_child);
}
}
} else if ('Number' == name) {
// detect if this is an integer or real
// TODO: add an ability to force one way or another via a "cast"
tag_type = (next % 1 === 0) ? 'integer' : 'real';
next_child.ele(tag_type).txt(next.toString());
} else if ('Date' == name) {
next_child.ele('date').txt(ISODateString(new Date(next)));
} else if ('Boolean' == name) {
next_child.ele(next ? 'true' : 'false');
} else if ('String' == name) {
next_child.ele('string').txt(next);
} else if ('ArrayBuffer' == name) {
next_child.ele('data').raw(base64.fromByteArray(next));
} else if (next && next.buffer && 'ArrayBuffer' == type(next.buffer)) {
// a typed array
next_child.ele('data').raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
}
}

215
app/node_modules/plist/lib/parse.js generated vendored Normal file
View File

@@ -0,0 +1,215 @@
/**
* Module dependencies.
*/
var DOMParser = require('xmldom').DOMParser;
/**
* Module exports.
*/
exports.parse = parse;
var TEXT_NODE = 3;
var CDATA_NODE = 4;
var COMMENT_NODE = 8;
/**
* We ignore raw text (usually whitespace), <!-- xml comments -->,
* and raw CDATA nodes.
*
* @param {Element} node
* @returns {Boolean}
* @api private
*/
function shouldIgnoreNode (node) {
return node.nodeType === TEXT_NODE
|| node.nodeType === COMMENT_NODE
|| node.nodeType === CDATA_NODE;
}
/**
* Check if the node is empty. Some plist file has such node:
* <key />
* this node shoud be ignored.
*
* @see https://github.com/TooTallNate/plist.js/issues/66
* @param {Element} node
* @returns {Boolean}
* @api private
*/
function isEmptyNode(node){
if(!node.childNodes || node.childNodes.length === 0) {
return true;
} else {
return false;
}
}
function invariant(test, message) {
if (!test) {
throw new Error(message);
}
}
/**
* Parses a Plist XML string. Returns an Object.
*
* @param {String} xml - the XML String to decode
* @returns {Mixed} the decoded value from the Plist XML
* @api public
*/
function parse (xml) {
var doc = new DOMParser().parseFromString(xml);
invariant(
doc.documentElement.nodeName === 'plist',
'malformed document. First element should be <plist>'
);
var plist = parsePlistXML(doc.documentElement);
// the root <plist> node gets interpreted as an Array,
// so pull out the inner data first
if (plist.length == 1) plist = plist[0];
return plist;
}
/**
* Convert an XML based plist document into a JSON representation.
*
* @param {Object} xml_node - current XML node in the plist
* @returns {Mixed} built up JSON object
* @api private
*/
function parsePlistXML (node) {
var i, new_obj, key, val, new_arr, res, counter, type;
if (!node)
return null;
if (node.nodeName === 'plist') {
new_arr = [];
if (isEmptyNode(node)) {
return new_arr;
}
for (i=0; i < node.childNodes.length; i++) {
if (!shouldIgnoreNode(node.childNodes[i])) {
new_arr.push( parsePlistXML(node.childNodes[i]));
}
}
return new_arr;
} else if (node.nodeName === 'dict') {
new_obj = {};
key = null;
counter = 0;
if (isEmptyNode(node)) {
return new_obj;
}
for (i=0; i < node.childNodes.length; i++) {
if (shouldIgnoreNode(node.childNodes[i])) continue;
if (counter % 2 === 0) {
invariant(
node.childNodes[i].nodeName === 'key',
'Missing key while parsing <dict/>.'
);
key = parsePlistXML(node.childNodes[i]);
} else {
invariant(
node.childNodes[i].nodeName !== 'key',
'Unexpected key "'
+ parsePlistXML(node.childNodes[i])
+ '" while parsing <dict/>.'
);
new_obj[key] = parsePlistXML(node.childNodes[i]);
}
counter += 1;
}
if (counter % 2 === 1) {
throw new Error('Missing value for "' + key + '" while parsing <dict/>');
}
return new_obj;
} else if (node.nodeName === 'array') {
new_arr = [];
if (isEmptyNode(node)) {
return new_arr;
}
for (i=0; i < node.childNodes.length; i++) {
if (!shouldIgnoreNode(node.childNodes[i])) {
res = parsePlistXML(node.childNodes[i]);
if (null != res) new_arr.push(res);
}
}
return new_arr;
} else if (node.nodeName === '#text') {
// TODO: what should we do with text types? (CDATA sections)
} else if (node.nodeName === 'key') {
if (isEmptyNode(node)) {
return '';
}
return node.childNodes[0].nodeValue;
} else if (node.nodeName === 'string') {
res = '';
if (isEmptyNode(node)) {
return res;
}
for (i=0; i < node.childNodes.length; i++) {
var type = node.childNodes[i].nodeType;
if (type === TEXT_NODE || type === CDATA_NODE) {
res += node.childNodes[i].nodeValue;
}
}
return res;
} else if (node.nodeName === 'integer') {
invariant(
!isEmptyNode(node),
'Cannot parse "" as integer.'
);
return parseInt(node.childNodes[0].nodeValue, 10);
} else if (node.nodeName === 'real') {
invariant(
!isEmptyNode(node),
'Cannot parse "" as real.'
);
res = '';
for (i=0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType === TEXT_NODE) {
res += node.childNodes[i].nodeValue;
}
}
return parseFloat(res);
} else if (node.nodeName === 'data') {
res = '';
if (isEmptyNode(node)) {
return new Buffer(res, 'base64');
}
for (i=0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType === TEXT_NODE) {
res += node.childNodes[i].nodeValue.replace(/\s+/g, '');
}
}
return new Buffer(res, 'base64');
} else if (node.nodeName === 'date') {
invariant(
!isEmptyNode(node),
'Cannot parse "" as Date.'
)
return new Date(node.childNodes[0].nodeValue);
} else if (node.nodeName === 'true') {
return true;
} else if (node.nodeName === 'false') {
return false;
}
}

21
app/node_modules/plist/node_modules/base64-js/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,32 @@
base64-js
=========
`base64-js` does basic base64 encoding/decoding in pure JS.
[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js)
[![testling badge](https://ci.testling.com/beatgammit/base64-js.png)](https://ci.testling.com/beatgammit/base64-js)
Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
## install
With [npm](https://npmjs.org) do:
`npm install base64-js`
## methods
`var base64 = require('base64-js')`
`base64` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
* `byteLength` - Takes a base64 string and returns length of byte array
* `toByteArray` - Takes a base64 string and returns a byte array
* `fromByteArray` - Takes a byte array and returns a base64 string
## license
MIT

View File

@@ -0,0 +1 @@
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,t;return function r(e,t,n){function o(i,a){if(!t[i]){if(!e[i]){var u=typeof require=="function"&&require;if(!a&&u)return u(i,!0);if(f)return f(i,!0);var d=new Error("Cannot find module '"+i+"'");throw d.code="MODULE_NOT_FOUND",d}var c=t[i]={exports:{}};e[i][0].call(c.exports,function(r){var t=e[i][1][r];return o(t?t:r)},c,c.exports,r,e,t,n)}return t[i].exports}var f=typeof require=="function"&&require;for(var i=0;i<n.length;i++)o(n[i]);return o}({"/":[function(r,e,t){"use strict";t.byteLength=c;t.toByteArray=v;t.fromByteArray=s;var n=[];var o=[];var f=typeof Uint8Array!=="undefined"?Uint8Array:Array;var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var a=0,u=i.length;a<u;++a){n[a]=i[a];o[i.charCodeAt(a)]=a}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function d(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return r[e-2]==="="?2:r[e-1]==="="?1:0}function c(r){return r.length*3/4-d(r)}function v(r){var e,t,n,i,a,u;var c=r.length;a=d(r);u=new f(c*3/4-a);n=a>0?c-4:c;var v=0;for(e=0,t=0;e<n;e+=4,t+=3){i=o[r.charCodeAt(e)]<<18|o[r.charCodeAt(e+1)]<<12|o[r.charCodeAt(e+2)]<<6|o[r.charCodeAt(e+3)];u[v++]=i>>16&255;u[v++]=i>>8&255;u[v++]=i&255}if(a===2){i=o[r.charCodeAt(e)]<<2|o[r.charCodeAt(e+1)]>>4;u[v++]=i&255}else if(a===1){i=o[r.charCodeAt(e)]<<10|o[r.charCodeAt(e+1)]<<4|o[r.charCodeAt(e+2)]>>2;u[v++]=i>>8&255;u[v++]=i&255}return u}function l(r){return n[r>>18&63]+n[r>>12&63]+n[r>>6&63]+n[r&63]}function h(r,e,t){var n;var o=[];for(var f=e;f<t;f+=3){n=(r[f]<<16)+(r[f+1]<<8)+r[f+2];o.push(l(n))}return o.join("")}function s(r){var e;var t=r.length;var o=t%3;var f="";var i=[];var a=16383;for(var u=0,d=t-o;u<d;u+=a){i.push(h(r,u,u+a>d?d:u+a))}if(o===1){e=r[t-1];f+=n[e>>2];f+=n[e<<4&63];f+="=="}else if(o===2){e=(r[t-2]<<8)+r[t-1];f+=n[e>>10];f+=n[e>>4&63];f+=n[e<<2&63];f+="="}i.push(f);return i.join("")}},{}]},{},[])("/")});

114
app/node_modules/plist/node_modules/base64-js/index.js generated vendored Normal file
View File

@@ -0,0 +1,114 @@
'use strict'
exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i]
revLookup[code.charCodeAt(i)] = i
}
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63
function placeHoldersCount (b64) {
var len = b64.length
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
}
function byteLength (b64) {
// base64 is 4/3 + up to two characters of the original data
return b64.length * 3 / 4 - placeHoldersCount(b64)
}
function toByteArray (b64) {
var i, j, l, tmp, placeHolders, arr
var len = b64.length
placeHolders = placeHoldersCount(b64)
arr = new Arr(len * 3 / 4 - placeHolders)
// if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len
var L = 0
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
arr[L++] = (tmp >> 16) & 0xFF
arr[L++] = (tmp >> 8) & 0xFF
arr[L++] = tmp & 0xFF
}
if (placeHolders === 2) {
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
arr[L++] = tmp & 0xFF
} else if (placeHolders === 1) {
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
arr[L++] = (tmp >> 8) & 0xFF
arr[L++] = tmp & 0xFF
}
return arr
}
function tripletToBase64 (num) {
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
}
function encodeChunk (uint8, start, end) {
var tmp
var output = []
for (var i = start; i < end; i += 3) {
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
output.push(tripletToBase64(tmp))
}
return output.join('')
}
function fromByteArray (uint8) {
var tmp
var len = uint8.length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var output = ''
var parts = []
var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1]
output += lookup[tmp >> 2]
output += lookup[(tmp << 4) & 0x3F]
output += '=='
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
output += lookup[tmp >> 10]
output += lookup[(tmp >> 4) & 0x3F]
output += lookup[(tmp << 2) & 0x3F]
output += '='
}
parts.push(output)
return parts.join('')
}

View File

@@ -0,0 +1,65 @@
{
"_from": "base64-js@1.2.0",
"_id": "base64-js@1.2.0",
"_inBundle": false,
"_integrity": "sha1-o5mS1yNYSBGYK+XikLtqU9hnAPE=",
"_location": "/plist/base64-js",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "base64-js@1.2.0",
"name": "base64-js",
"escapedName": "base64-js",
"rawSpec": "1.2.0",
"saveSpec": null,
"fetchSpec": "1.2.0"
},
"_requiredBy": [
"/plist"
],
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.0.tgz",
"_shasum": "a39992d723584811982be5e290bb6a53d86700f1",
"_spec": "base64-js@1.2.0",
"_where": "F:\\projects\\p\\gitlit\\app\\node_modules\\plist",
"author": {
"name": "T. Jameson Little",
"email": "t.jameson.little@gmail.com"
},
"bugs": {
"url": "https://github.com/beatgammit/base64-js/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Base64 encoding/decoding in pure JS",
"devDependencies": {
"benchmark": "^2.1.0",
"browserify": "^13.0.0",
"standard": "*",
"tape": "4.x",
"uglify-js": "^2.6.2"
},
"files": [
"test",
"index.js",
"base64js.min.js"
],
"homepage": "https://github.com/beatgammit/base64-js",
"keywords": [
"base64"
],
"license": "MIT",
"main": "index.js",
"name": "base64-js",
"repository": {
"type": "git",
"url": "git://github.com/beatgammit/base64-js.git"
},
"scripts": {
"build": "browserify -s base64js -r ./ | uglifyjs -m > base64js.min.js",
"lint": "standard",
"test": "npm run lint && npm run unit",
"unit": "tape test/*.js"
},
"version": "1.2.0"
}

View File

@@ -0,0 +1,24 @@
var test = require('tape')
var b64 = require('../')
test('convert big data to base64', function (t) {
var b64str, arr, i, length
var big = new Uint8Array(64 * 1024 * 1024)
for (i = 0, length = big.length; i < length; ++i) {
big[i] = i % 256
}
b64str = b64.fromByteArray(big)
arr = b64.toByteArray(b64str)
t.ok(equal(arr, big))
t.end()
})
function equal (a, b) {
var i
var length = a.length
if (length !== b.length) return false
for (i = 0; i < length; ++i) {
if (a[i] !== b[i]) return false
}
return true
}

View File

@@ -0,0 +1,48 @@
var test = require('tape')
var b64 = require('../')
var checks = [
'a',
'aa',
'aaa',
'hi',
'hi!',
'hi!!',
'sup',
'sup?',
'sup?!'
]
test('convert to base64 and back', function (t) {
t.plan(checks.length * 2)
for (var i = 0; i < checks.length; i++) {
var check = checks[i]
var b64Str, arr, str
b64Str = b64.fromByteArray(map(check, function (char) { return char.charCodeAt(0) }))
arr = b64.toByteArray(b64Str)
str = map(arr, function (byte) { return String.fromCharCode(byte) }).join('')
t.equal(check, str, 'Checked ' + check)
t.equal(b64.byteLength(b64Str), arr.length, 'Checked length for ' + check)
}
})
function map (arr, callback) {
var res = []
var kValue, mappedValue
for (var k = 0, len = arr.length; k < len; k++) {
if ((typeof arr === 'string' && !!arr.charAt(k))) {
kValue = arr.charAt(k)
mappedValue = callback(kValue, k, arr)
res[k] = mappedValue
} else if (typeof arr !== 'string' && k in arr) {
kValue = arr[k]
mappedValue = callback(kValue, k, arr)
res[k] = mappedValue
}
}
return res
}

View File

@@ -0,0 +1,18 @@
var test = require('tape')
var b64 = require('../')
test('decode url-safe style base64 strings', function (t) {
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]
var actual = b64.toByteArray('//++/++/++//')
for (var i = 0; i < actual.length; i++) {
t.equal(actual[i], expected[i])
}
actual = b64.toByteArray('__--_--_--__')
for (i = 0; i < actual.length; i++) {
t.equal(actual[i], expected[i])
}
t.end()
})

View File

@@ -0,0 +1,5 @@
.travis.yml
src
test
perf
coverage

View File

@@ -0,0 +1,395 @@
# 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).
## [8.2.2] - 2016-04-08
- Falsy values can now be used as a text node in callback mode.
## [8.2.1] - 2016-04-07
- Falsy values can now be used as a text node. See
[#117](https://github.com/oozcitak/xmlbuilder-js/issues/117).
## [8.2.0] - 2016-04-01
- Removed lodash dependency to keep the library small and simple. See
[#114](https://github.com/oozcitak/xmlbuilder-js/issues/114),
[#53](https://github.com/oozcitak/xmlbuilder-js/issues/53),
and [#43](https://github.com/oozcitak/xmlbuilder-js/issues/43).
- Added title case to name conversion options.
## [8.1.0] - 2016-03-29
- Added the callback option to the `begin` export function. When used with a
callback function, the XML document will be generated in chunks and each chunk
will be passed to the supplied function. In this mode, `begin` uses a different
code path and the builder should use much less memory since the entire XML tree
is not kept. There are a few drawbacks though. For example, traversing the document
tree or adding attributes to a node after it is written is not possible. It is
also not possible to remove nodes or attributes.
``` js
var result = '';
builder.begin(function(chunk) { result += chunk; })
.dec()
.ele('root')
.ele('xmlbuilder').up()
.end();
```
- Replaced native `Object.assign` with `lodash.assign` to support old JS engines. See [#111](https://github.com/oozcitak/xmlbuilder-js/issues/111).
## [8.0.0] - 2016-03-25
- Added the `begin` export function. See the wiki for details.
- Added the ability to add comments and processing instructions before and after the root element. Added `commentBefore`, `commentAfter`, `instructionBefore` and `instructionAfter` functions for this purpose.
- Dropped support for old node.js releases. Minimum required node.js version is now 4.0.
## [7.0.0] - 2016-03-21
- Processing instructions are now created as regular nodes. This is a major breaking change if you are using processing instructions. Previously processing instructions were inserted before their parent node. After this change processing instructions are appended to the children of the parent node. Note that it is not currently possible to insert processing instructions before or after the root element.
```js
root.ele('node').ins('pi');
// pre-v7
<?pi?><node/>
// v7
<node><?pi?></node>
```
## [6.0.0] - 2016-03-20
- Added custom XML writers. The default string conversion functions are now collected under the `XMLStringWriter` class which can be accessed by the `stringWriter(options)` function exported by the module. An `XMLStreamWriter` is also added which outputs the XML document to a writable stream. A stream writer can be created by calling the `streamWriter(stream, options)` function exported by the module. Both classes are heavily customizable and the details are added to the wiki. It is also possible to write an XML writer from scratch and use it when calling `end()` on the XML document.
## [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
- Added text case option for element names and attribute names. Valid cases are `lower`, `upper`, `camel`, `kebab` and `snake`.
- Attribute and element values are escaped according to the [Canonical XML 1.0 specification](http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping). See [#54](https://github.com/oozcitak/xmlbuilder-js/issues/54) and [#86](https://github.com/oozcitak/xmlbuilder-js/issues/86).
- Added the `allowEmpty` option to `end()`. When this option is set, empty elements are not self-closed.
- Added support for [nested CDATA](https://en.wikipedia.org/wiki/CDATA#Nesting). The triad `]]>` in CDATA is now automatically replaced with `]]]]><![CDATA[>`.
## [4.2.1] - 2016-01-15
- Updated lodash dependency to 4.0.0.
## [4.2.0] - 2015-12-16
- Added the `noDoubleEncoding` option to `create()` to control whether existing html entities are encoded.
## [4.1.0] - 2015-11-11
- Added the `separateArrayItems` option to `create()` to control how arrays are handled when converting from objects. e.g.
```js
root.ele({ number: [ "one", "two" ]});
// with separateArrayItems: true
<number>
<one/>
<two/>
</number>
// with separateArrayItems: false
<number>one</number>
<number>two</number>
```
## [4.0.0] - 2015-11-01
- Removed the `#list` decorator. Array items are now created as child nodes by default.
- Fixed a bug where the XML encoding string was checked partially.
## [3.1.0] - 2015-09-19
- `#list` decorator ignores empty arrays.
## [3.0.0] - 2015-09-10
- Allow `\r`, `\n` and `\t` in attribute values without escaping. See [#86](https://github.com/oozcitak/xmlbuilder-js/issues/86).
## [2.6.5] - 2015-09-09
- Use native `isArray` instead of lodash.
- Indentation of processing instructions are set to the parent element's.
## [2.6.4] - 2015-05-27
- Updated lodash dependency to 3.5.0.
## [2.6.3] - 2015-05-27
- Bumped version because previous release was not published on npm.
## [2.6.2] - 2015-03-10
- Updated lodash dependency to 3.5.0.
## [2.6.1] - 2015-02-20
- Updated lodash dependency to 3.3.0.
## [2.6.0] - 2015-02-20
- Fixed a bug where the `XMLNode` constructor overwrote the super class parent.
- Removed document property from cloned nodes.
- Switched to mocha.js for testing.
## [2.5.2] - 2015-02-16
- Updated lodash dependency to 3.2.0.
## [2.5.1] - 2015-02-09
- Updated lodash dependency to 3.1.0.
- Support all node >= 0.8.
## [2.5.0] - 2015-00-03
- Updated lodash dependency to 3.0.0.
## [2.4.6] - 2015-01-26
- Show more information from attribute creation with null values.
- Added iojs as an engine.
- Self close elements with empty text.
## [2.4.5] - 2014-11-15
- Fixed prepublish script to run on windows.
- 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 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.
## [2.4.3] - 2014-08-13
- Corrected license in package description.
## [2.4.2] - 2014-08-13
- Dropped performance test and memwatch dependency.
## [2.4.1] - 2014-08-12
- Fixed a bug where empty indent string was omitted when pretty printing. See [#59](https://github.com/oozcitak/xmlbuilder-js/issues/59).
## [2.4.0] - 2014-08-04
- Correct cases of pubID and sysID.
- 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).
## [2.3.0] - 2014-07-17
- Convert objects to JS primitives while sanitizing user input.
- Object builder preserves items with null values. See [#44](https://github.com/oozcitak/xmlbuilder-js/issues/44).
- Use modularized lodash functions to cut down dependencies.
- Process empty objects when converting from objects so that we don't throw on empty child objects.
## [2.2.1] - 2014-04-04
- Bumped version because previous release was not published on npm.
## [2.2.0] - 2014-04-04
- Switch to lodash from underscore.
- Removed legacy `ext` option from `create()`.
- Drop old node versions: 0.4, 0.5, 0.6. 0.8 is the minimum requirement from now on.
## [2.1.0] - 2013-12-30
- Removed duplicate null checks from constructors.
- Fixed node count in performance test.
- Added option for skipping null attribute values. See [#26](https://github.com/oozcitak/xmlbuilder-js/issues/26).
- Allow multiple values in `att()` and `ins()`.
- Added ability to run individual performance tests.
- Added flag for ignoring decorator strings.
## [2.0.1] - 2013-12-24
- Removed performance tests from npm package.
## [2.0.0] - 2013-12-24
- Combined loops for speed up.
- Added support for the DTD and XML declaration.
- `clone` includes attributes.
- Added performance tests.
- Evaluate attribute value if function.
- Evaluate instruction value if function.
## [1.1.2] - 2013-12-11
- Changed processing instruction decorator to `?`.
## [1.1.1] - 2013-12-11
- Added processing instructions to JS object conversion.
## [1.1.0] - 2013-12-10
- Added license to package.
- `create()` and `element()` accept JS object to fully build the document.
- Added `nod()` and `n()` aliases for `node()`.
- Renamed `convertAttChar` decorator to `convertAttKey`.
- Ignore empty decorator strings when converting JS objects.
## [1.0.2] - 2013-11-27
- Removed temp file which was accidentally included in the package.
## [1.0.1] - 2013-11-27
- Custom stringify functions affect current instance only.
## [1.0.0] - 2013-11-27
- Added processing instructions.
- Added stringify functions to sanitize and convert input values.
- Added option for headless XML documents.
- Added vows tests.
- Removed Makefile. Using npm publish scripts instead.
- Removed the `begin()` function. `create()` begins the document by creating the root node.
## [0.4.3] - 2013-11-08
- Added option to include surrogate pairs in XML content. See [#29](https://github.com/oozcitak/xmlbuilder-js/issues/29).
- Fixed empty value string representation in pretty mode.
- Added pre and postpublish scripts to package.json.
- Filtered out prototype properties when appending attributes. See [#31](https://github.com/oozcitak/xmlbuilder-js/issues/31).
## [0.4.2] - 2012-09-14
- Removed README.md from `.npmignore`.
## [0.4.1] - 2012-08-31
- Removed `begin()` calls in favor of `XMLBuilder` constructor.
- Added the `end()` function. `end()` is a convenience over `doc().toString()`.
## [0.4.0] - 2012-08-31
- Added arguments to `XMLBuilder` constructor to allow the name of the root element and XML prolog to be defined in one line.
- Soft deprecated `begin()`.
## [0.3.11] - 2012-08-13
- Package keywords are fixed to be an array of values.
## [0.3.10] - 2012-08-13
- Brought back npm package contents which were lost due to incorrect configuration of `package.json` in previous releases.
## [0.3.3] - 2012-07-27
- Implemented `importXMLBuilder()`.
## [0.3.2] - 2012-07-20
- Fixed a duplicated escaping problem on `element()`.
- Fixed a problem with text node creation from empty string.
- Calling `root()` on the document element returns the root element.
- `XMLBuilder` no longer extends `XMLFragment`.
## [0.3.1] - 2011-11-28
- Added guards for document element so that nodes cannot be inserted at document level.
## [0.3.0] - 2011-11-28
- Added `doc()` to return the document element.
## [0.2.2] - 2011-11-28
- Prevent code relying on `up()`'s older behavior to break.
## [0.2.1] - 2011-11-28
- Added the `root()` function.
## [0.2.0] - 2011-11-21
- Added Travis-CI integration.
- Added coffee-script dependency.
- Added insert, traversal and delete functions.
## [0.1.7] - 2011-10-25
- No changes. Accidental release.
## [0.1.6] - 2011-10-25
- Corrected `package.json` bugs link to `url` from `web`.
## [0.1.5] - 2011-08-08
- Added missing npm package contents.
## [0.1.4] - 2011-07-29
- Text-only nodes are no longer indented.
- Added documentation for multiple instances.
## [0.1.3] - 2011-07-27
- Exported the `create()` function to return a new instance. This allows multiple builder instances to be constructed.
- Fixed `u()` function so that it now correctly calls `up()`.
- Fixed typo in `element()` so that `attributes` and `text` can be passed interchangeably.
## [0.1.2] - 2011-06-03
- `ele()` accepts element text.
- `attributes()` now overrides existing attributes if passed the same attribute name.
## [0.1.1] - 2011-05-19
- Added the raw output option.
- Removed most validity checks.
## [0.1.0] - 2011-04-27
- `text()` and `cdata()` now return parent element.
- Attribute values are escaped.
## [0.0.7] - 2011-04-23
- Coerced text values to string.
## [0.0.6] - 2011-02-23
- Added support for XML comments.
- Text nodes are checked against CharData.
## [0.0.5] - 2010-12-31
- Corrected the name of the main npm module in `package.json`.
## [0.0.4] - 2010-12-28
- Added `.npmignore`.
## [0.0.3] - 2010-12-27
- root element is now constructed in `begin()`.
- moved prolog to `begin()`.
- Added the ability to have CDATA in element text.
- Removed unused prolog aliases.
- Removed `builder()` function from main module.
- Added the name of the main npm module in `package.json`.
## [0.0.2] - 2010-11-03
- `element()` expands nested arrays.
- Added pretty printing.
- Added the `up()`, `build()` and `prolog()` functions.
- Added readme.
## 0.0.1 - 2010-11-02
- Initial release
[8.2.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v8.2.1...v8.2.2
[8.2.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v8.2.0...v8.2.1
[8.2.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v8.1.0...v8.2.0
[8.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v8.0.0...v8.1.0
[8.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v7.0.0...v8.0.0
[7.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v6.0.0...v7.0.0
[6.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v5.0.1...v6.0.0
[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
[4.2.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v4.2.0...v4.2.1
[4.2.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v4.1.0...v4.2.0
[4.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v4.0.0...v4.1.0
[4.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v3.1.0...v4.0.0
[3.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v3.0.0...v3.1.0
[3.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.6.5...v3.0.0
[2.6.5]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.6.4...v2.6.5
[2.6.4]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.6.3...v2.6.4
[2.6.3]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.6.2...v2.6.3
[2.6.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.6.1...v2.6.2
[2.6.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.6.0...v2.6.1
[2.6.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.5.2...v2.6.0
[2.5.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.5.1...v2.5.2
[2.5.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.5.0...v2.5.1
[2.5.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.6...v2.5.0
[2.4.6]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.5...v2.4.6
[2.4.5]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.4...v2.4.5
[2.4.4]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.3...v2.4.4
[2.4.3]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.2...v2.4.3
[2.4.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.1...v2.4.2
[2.4.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.2.1...v2.3.0
[2.2.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v1.1.2...v2.0.0
[1.1.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.4.3...v1.0.0
[0.4.3]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.3.11...v0.4.0
[0.3.11]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.3.10...v0.3.11
[0.3.10]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.3.3...v0.3.10
[0.3.3]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.3.2...v0.3.3
[0.3.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.2.2...v0.3.0
[0.2.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.7...v0.2.0
[0.1.7]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.6...v0.1.7
[0.1.6]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.5...v0.1.6
[0.1.5]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.4...v0.1.5
[0.1.4]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.7...v0.1.0
[0.0.7]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.6...v0.0.7
[0.0.6]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.5...v0.0.6
[0.0.5]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.4...v0.0.5
[0.0.4]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.3...v0.0.4
[0.0.3]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/oozcitak/xmlbuilder-js/compare/v0.0.1...v0.0.2

21
app/node_modules/plist/node_modules/xmlbuilder/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013 Ozgur Ozcitak
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,85 @@
# xmlbuilder-js
An XML builder for [node.js](https://nodejs.org/) similar to
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
[![NPM Downloads](https://img.shields.io/npm/dm/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
[![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js)
### Installation:
``` sh
npm install xmlbuilder
```
### Usage:
``` js
var builder = require('xmlbuilder');
var xml = builder.create('root')
.ele('xmlbuilder')
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
.end({ pretty: true});
console.log(xml);
```
will result in:
``` xml
<?xml version="1.0"?>
<root>
<xmlbuilder>
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
</xmlbuilder>
</root>
```
It is also possible to convert objects into nodes:
``` js
builder.create({
root: {
xmlbuilder: {
repo: {
'@type': 'git', // attributes start with @
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node
}
}
}
});
```
If you need to do some processing:
``` js
var root = builder.create('squares');
root.com('f(x) = x^2');
for(var i = 1; i <= 5; i++)
{
var item = root.ele('data');
item.att('x', i);
item.att('y', i * i);
}
```
This will result in:
``` xml
<?xml version="1.0"?>
<squares>
<!-- f(x) = x^2 -->
<data x="1" y="1"/>
<data x="2" y="4"/>
<data x="3" y="9"/>
<data x="4" y="16"/>
<data x="5" y="25"/>
</squares>
```
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details.

View File

@@ -0,0 +1,139 @@
// Generated by CoffeeScript 1.10.0
(function() {
var assign, camelCase, capitalize, isArray, isEmpty, isFunction, isObject, isPlainObject, kebabCase, snakeCase, titleCase, words,
slice = [].slice,
hasProp = {}.hasOwnProperty;
assign = function() {
var i, key, len, source, sources, target;
target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
if (isFunction(Object.assign)) {
Object.assign.apply(null, arguments);
} else {
for (i = 0, len = sources.length; i < len; i++) {
source = sources[i];
if (source != null) {
for (key in source) {
if (!hasProp.call(source, key)) continue;
target[key] = source[key];
}
}
}
}
return target;
};
isFunction = function(val) {
return !!val && Object.prototype.toString.call(val) === '[object Function]';
};
isObject = function(val) {
var ref;
return !!val && ((ref = typeof val) === 'function' || ref === 'object');
};
isArray = function(val) {
if (isFunction(Array.isArray)) {
return Array.isArray(val);
} else {
return Object.prototype.toString.call(val) === '[object Array]';
}
};
isEmpty = function(val) {
var key;
if (isArray(val)) {
return !val.length;
} else {
for (key in val) {
if (!hasProp.call(val, key)) continue;
return false;
}
return true;
}
};
isPlainObject = function(val) {
var ctor, proto;
return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
};
words = function(val) {
return (val.split(/[-_\s]+|(?=[A-Z][a-z])/) || []).filter(function(n) {
return !!n;
});
};
camelCase = function(val) {
var i, index, len, r, ref, word;
r = '';
ref = words(val);
for (index = i = 0, len = ref.length; i < len; index = ++i) {
word = ref[index];
r += index ? capitalize(word.toLowerCase()) : word.toLowerCase();
}
return r;
};
titleCase = function(val) {
var i, index, len, r, ref, word;
r = '';
ref = words(val);
for (index = i = 0, len = ref.length; i < len; index = ++i) {
word = ref[index];
r += capitalize(word.toLowerCase());
}
return r;
};
kebabCase = function(val) {
var i, index, len, r, ref, word;
r = '';
ref = words(val);
for (index = i = 0, len = ref.length; i < len; index = ++i) {
word = ref[index];
r += (index ? '-' : '') + word.toLowerCase();
}
return r;
};
snakeCase = function(val) {
var i, index, len, r, ref, word;
r = '';
ref = words(val);
for (index = i = 0, len = ref.length; i < len; index = ++i) {
word = ref[index];
r += (index ? '_' : '') + word.toLowerCase();
}
return r;
};
capitalize = function(val) {
return val.charAt(0).toUpperCase() + val.slice(1);
};
module.exports.assign = assign;
module.exports.isFunction = isFunction;
module.exports.isObject = isObject;
module.exports.isArray = isArray;
module.exports.isEmpty = isEmpty;
module.exports.isPlainObject = isPlainObject;
module.exports.camelCase = camelCase;
module.exports.titleCase = titleCase;
module.exports.kebabCase = kebabCase;
module.exports.snakeCase = snakeCase;
module.exports.capitalize = capitalize;
module.exports.words = words;
}).call(this);

View File

@@ -0,0 +1,31 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLAttribute;
module.exports = XMLAttribute = (function() {
function XMLAttribute(parent, name, value) {
this.options = parent.options;
this.stringify = parent.stringify;
if (name == null) {
throw new Error("Missing attribute name of element " + parent.name);
}
if (value == null) {
throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name);
}
this.name = this.stringify.attName(name);
this.value = this.stringify.attValue(value);
}
XMLAttribute.prototype.clone = function() {
return Object.create(this);
};
XMLAttribute.prototype.toString = function(options) {
return this.options.writer.set(options).attribute(this);
};
return XMLAttribute;
})();
}).call(this);

View File

@@ -0,0 +1,32 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLCData, XMLNode,
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;
XMLNode = require('./XMLNode');
module.exports = XMLCData = (function(superClass) {
extend(XMLCData, superClass);
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 Object.create(this);
};
XMLCData.prototype.toString = function(options) {
return this.options.writer.set(options).cdata(this);
};
return XMLCData;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,32 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLComment, XMLNode,
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;
XMLNode = require('./XMLNode');
module.exports = XMLComment = (function(superClass) {
extend(XMLComment, superClass);
function XMLComment(parent, text) {
XMLComment.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing comment text");
}
this.text = this.stringify.comment(text);
}
XMLComment.prototype.clone = function() {
return Object.create(this);
};
XMLComment.prototype.toString = function(options) {
return this.options.writer.set(options).comment(this);
};
return XMLComment;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,50 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDTDAttList, XMLNode,
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;
XMLNode = require('./XMLNode');
module.exports = XMLDTDAttList = (function(superClass) {
extend(XMLDTDAttList, superClass);
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
XMLDTDAttList.__super__.constructor.call(this, parent);
if (elementName == null) {
throw new Error("Missing DTD element name");
}
if (attributeName == null) {
throw new Error("Missing DTD attribute name");
}
if (!attributeType) {
throw new Error("Missing DTD attribute type");
}
if (!defaultValueType) {
throw new Error("Missing DTD attribute default");
}
if (defaultValueType.indexOf('#') !== 0) {
defaultValueType = '#' + defaultValueType;
}
if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");
}
if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
throw new Error("Default value only applies to #FIXED or #DEFAULT");
}
this.elementName = this.stringify.eleName(elementName);
this.attributeName = this.stringify.attName(attributeName);
this.attributeType = this.stringify.dtdAttType(attributeType);
this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
this.defaultValueType = defaultValueType;
}
XMLDTDAttList.prototype.toString = function(options) {
return this.options.writer.set(options).dtdAttList(this);
};
return XMLDTDAttList;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,35 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDTDElement, XMLNode,
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;
XMLNode = require('./XMLNode');
module.exports = XMLDTDElement = (function(superClass) {
extend(XMLDTDElement, superClass);
function XMLDTDElement(parent, name, value) {
XMLDTDElement.__super__.constructor.call(this, parent);
if (name == null) {
throw new Error("Missing DTD element name");
}
if (!value) {
value = '(#PCDATA)';
}
if (Array.isArray(value)) {
value = '(' + value.join(',') + ')';
}
this.name = this.stringify.eleName(name);
this.value = this.stringify.dtdElementValue(value);
}
XMLDTDElement.prototype.toString = function(options) {
return this.options.writer.set(options).dtdElement(this);
};
return XMLDTDElement;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,56 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDTDEntity, XMLNode, 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;
XMLNode = require('./XMLNode');
module.exports = XMLDTDEntity = (function(superClass) {
extend(XMLDTDEntity, superClass);
function XMLDTDEntity(parent, pe, name, value) {
XMLDTDEntity.__super__.constructor.call(this, parent);
if (name == null) {
throw new Error("Missing entity name");
}
if (value == null) {
throw new Error("Missing entity value");
}
this.pe = !!pe;
this.name = this.stringify.eleName(name);
if (!isObject(value)) {
this.value = this.stringify.dtdEntityValue(value);
} else {
if (!value.pubID && !value.sysID) {
throw new Error("Public and/or system identifiers are required for an external entity");
}
if (value.pubID && !value.sysID) {
throw new Error("System identifier is required for a public external entity");
}
if (value.pubID != null) {
this.pubID = this.stringify.dtdPubID(value.pubID);
}
if (value.sysID != null) {
this.sysID = this.stringify.dtdSysID(value.sysID);
}
if (value.nData != null) {
this.nData = this.stringify.dtdNData(value.nData);
}
if (this.pe && this.nData) {
throw new Error("Notation declaration is not allowed in a parameter entity");
}
}
}
XMLDTDEntity.prototype.toString = function(options) {
return this.options.writer.set(options).dtdEntity(this);
};
return XMLDTDEntity;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,37 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDTDNotation, XMLNode,
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;
XMLNode = require('./XMLNode');
module.exports = XMLDTDNotation = (function(superClass) {
extend(XMLDTDNotation, superClass);
function XMLDTDNotation(parent, name, value) {
XMLDTDNotation.__super__.constructor.call(this, parent);
if (name == null) {
throw new Error("Missing notation name");
}
if (!value.pubID && !value.sysID) {
throw new Error("Public or system identifiers are required for an external entity");
}
this.name = this.stringify.eleName(name);
if (value.pubID != null) {
this.pubID = this.stringify.dtdPubID(value.pubID);
}
if (value.sysID != null) {
this.sysID = this.stringify.dtdSysID(value.sysID);
}
}
XMLDTDNotation.prototype.toString = function(options) {
return this.options.writer.set(options).dtdNotation(this);
};
return XMLDTDNotation;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,40 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDeclaration, XMLNode, 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;
XMLNode = require('./XMLNode');
module.exports = XMLDeclaration = (function(superClass) {
extend(XMLDeclaration, superClass);
function XMLDeclaration(parent, version, encoding, standalone) {
var ref;
XMLDeclaration.__super__.constructor.call(this, parent);
if (isObject(version)) {
ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
}
if (!version) {
version = '1.0';
}
this.version = this.stringify.xmlVersion(version);
if (encoding != null) {
this.encoding = this.stringify.xmlEncoding(encoding);
}
if (standalone != null) {
this.standalone = this.stringify.xmlStandalone(standalone);
}
}
XMLDeclaration.prototype.toString = function(options) {
return this.options.writer.set(options).declaration(this);
};
return XMLDeclaration;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,107 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, 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;
XMLNode = require('./XMLNode');
XMLDTDAttList = require('./XMLDTDAttList');
XMLDTDEntity = require('./XMLDTDEntity');
XMLDTDElement = require('./XMLDTDElement');
XMLDTDNotation = require('./XMLDTDNotation');
module.exports = XMLDocType = (function(superClass) {
extend(XMLDocType, superClass);
function XMLDocType(parent, pubID, sysID) {
var ref, ref1;
XMLDocType.__super__.constructor.call(this, parent);
this.documentObject = parent;
if (isObject(pubID)) {
ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
}
if (sysID == null) {
ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
}
if (pubID != null) {
this.pubID = this.stringify.dtdPubID(pubID);
}
if (sysID != null) {
this.sysID = this.stringify.dtdSysID(sysID);
}
}
XMLDocType.prototype.element = function(name, value) {
var child;
child = new XMLDTDElement(this, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
var child;
child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
this.children.push(child);
return this;
};
XMLDocType.prototype.entity = function(name, value) {
var child;
child = new XMLDTDEntity(this, false, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.pEntity = function(name, value) {
var child;
child = new XMLDTDEntity(this, true, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.notation = function(name, value) {
var child;
child = new XMLDTDNotation(this, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.toString = function(options) {
return this.options.writer.set(options).docType(this);
};
XMLDocType.prototype.ele = function(name, value) {
return this.element(name, value);
};
XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
};
XMLDocType.prototype.ent = function(name, value) {
return this.entity(name, value);
};
XMLDocType.prototype.pent = function(name, value) {
return this.pEntity(name, value);
};
XMLDocType.prototype.not = function(name, value) {
return this.notation(name, value);
};
XMLDocType.prototype.up = function() {
return this.root() || this.documentObject;
};
return XMLDocType;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,48 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
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;
isPlainObject = require('./Utility').isPlainObject;
XMLNode = require('./XMLNode');
XMLStringifier = require('./XMLStringifier');
XMLStringWriter = require('./XMLStringWriter');
module.exports = XMLDocument = (function(superClass) {
extend(XMLDocument, superClass);
function XMLDocument(options) {
XMLDocument.__super__.constructor.call(this, null);
options || (options = {});
if (!options.writer) {
options.writer = new XMLStringWriter();
}
this.options = options;
this.stringify = new XMLStringifier(options);
this.isDocument = true;
}
XMLDocument.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);
};
XMLDocument.prototype.toString = function(options) {
return this.options.writer.set(options).document(this);
};
return XMLDocument;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,402 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject, ref,
hasProp = {}.hasOwnProperty;
ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject;
XMLElement = require('./XMLElement');
XMLCData = require('./XMLCData');
XMLComment = require('./XMLComment');
XMLRaw = require('./XMLRaw');
XMLText = require('./XMLText');
XMLProcessingInstruction = require('./XMLProcessingInstruction');
XMLDeclaration = require('./XMLDeclaration');
XMLDocType = require('./XMLDocType');
XMLDTDAttList = require('./XMLDTDAttList');
XMLDTDEntity = require('./XMLDTDEntity');
XMLDTDElement = require('./XMLDTDElement');
XMLDTDNotation = require('./XMLDTDNotation');
XMLAttribute = require('./XMLAttribute');
XMLStringifier = require('./XMLStringifier');
XMLStringWriter = require('./XMLStringWriter');
module.exports = XMLDocumentCB = (function() {
function XMLDocumentCB(options, onData, onEnd) {
var writerOptions;
options || (options = {});
if (!options.writer) {
options.writer = new XMLStringWriter(options);
} else if (isPlainObject(options.writer)) {
writerOptions = options.writer;
options.writer = new XMLStringWriter(writerOptions);
}
this.options = options;
this.writer = options.writer;
this.stringify = new XMLStringifier(options);
this.onDataCallback = onData || function() {};
this.onEndCallback = onEnd || function() {};
this.currentNode = null;
this.currentLevel = -1;
this.openTags = {};
this.documentStarted = false;
this.documentCompleted = false;
this.root = null;
}
XMLDocumentCB.prototype.node = function(name, attributes, text) {
var ref1;
if (name == null) {
throw new Error("Missing node name");
}
if (this.root && this.currentLevel === -1) {
throw new Error("Document can only have one root node");
}
this.openCurrent();
name = name.valueOf();
if (attributes == null) {
attributes = {};
}
attributes = attributes.valueOf();
if (!isObject(attributes)) {
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}
this.currentNode = new XMLElement(this, name, attributes);
this.currentNode.children = false;
this.currentLevel++;
this.openTags[this.currentLevel] = this.currentNode;
if (text != null) {
this.text(text);
}
return this;
};
XMLDocumentCB.prototype.element = function(name, attributes, text) {
if (this.currentNode && this.currentNode instanceof XMLDocType) {
return this.dtdElement.apply(this, arguments);
} else {
return this.node(name, attributes, text);
}
};
XMLDocumentCB.prototype.attribute = function(name, value) {
var attName, attValue;
if (!this.currentNode || this.currentNode.children) {
throw new Error("att() can only be used immediately after an ele() call in callback mode");
}
if (name != null) {
name = name.valueOf();
}
if (isObject(name)) {
for (attName in name) {
if (!hasProp.call(name, attName)) continue;
attValue = name[attName];
this.attribute(attName, attValue);
}
} else {
if (isFunction(value)) {
value = value.apply();
}
if (!this.options.skipNullAttributes || (value != null)) {
this.currentNode.attributes[name] = new XMLAttribute(this, name, value);
}
}
return this;
};
XMLDocumentCB.prototype.text = function(value) {
var node;
this.openCurrent();
node = new XMLText(this, value);
this.onData(this.writer.text(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.cdata = function(value) {
var node;
this.openCurrent();
node = new XMLCData(this, value);
this.onData(this.writer.cdata(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.comment = function(value) {
var node;
this.openCurrent();
node = new XMLComment(this, value);
this.onData(this.writer.comment(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.raw = function(value) {
var node;
this.openCurrent();
node = new XMLRaw(this, value);
this.onData(this.writer.raw(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.instruction = function(target, value) {
var i, insTarget, insValue, len, node;
this.openCurrent();
if (target != null) {
target = target.valueOf();
}
if (value != null) {
value = value.valueOf();
}
if (Array.isArray(target)) {
for (i = 0, len = target.length; i < len; i++) {
insTarget = target[i];
this.instruction(insTarget);
}
} else if (isObject(target)) {
for (insTarget in target) {
if (!hasProp.call(target, insTarget)) continue;
insValue = target[insTarget];
this.instruction(insTarget, insValue);
}
} else {
if (isFunction(value)) {
value = value.apply();
}
node = new XMLProcessingInstruction(this, target, value);
this.onData(this.writer.processingInstruction(node, this.currentLevel + 1));
}
return this;
};
XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
var node;
this.openCurrent();
if (this.documentStarted) {
throw new Error("declaration() must be the first node");
}
node = new XMLDeclaration(this, version, encoding, standalone);
this.onData(this.writer.declaration(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
this.openCurrent();
if (root == null) {
throw new Error("Missing root node name");
}
if (this.root) {
throw new Error("dtd() must come before the root node");
}
this.currentNode = new XMLDocType(this, pubID, sysID);
this.currentNode.rootNodeName = root;
this.currentNode.children = false;
this.currentLevel++;
this.openTags[this.currentLevel] = this.currentNode;
return this;
};
XMLDocumentCB.prototype.dtdElement = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDElement(this, name, value);
this.onData(this.writer.dtdElement(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
var node;
this.openCurrent();
node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
this.onData(this.writer.dtdAttList(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.entity = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDEntity(this, false, name, value);
this.onData(this.writer.dtdEntity(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.pEntity = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDEntity(this, true, name, value);
this.onData(this.writer.dtdEntity(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.notation = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDNotation(this, name, value);
this.onData(this.writer.dtdNotation(node, this.currentLevel + 1));
return this;
};
XMLDocumentCB.prototype.up = function() {
if (this.currentLevel < 0) {
throw new Error("The document node has no parent");
}
if (this.currentNode) {
if (this.currentNode.children) {
this.closeNode(this.currentNode);
} else {
this.openNode(this.currentNode);
}
this.currentNode = null;
} else {
this.closeNode(this.openTags[this.currentLevel]);
}
delete this.openTags[this.currentLevel];
this.currentLevel--;
return this;
};
XMLDocumentCB.prototype.end = function() {
while (this.currentLevel >= 0) {
this.up();
}
return this.onEnd();
};
XMLDocumentCB.prototype.openCurrent = function() {
if (this.currentNode) {
this.currentNode.children = true;
return this.openNode(this.currentNode);
}
};
XMLDocumentCB.prototype.openNode = function(node) {
if (!node.isOpen) {
if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) {
this.root = node;
}
this.onData(this.writer.openNode(node, this.currentLevel));
return node.isOpen = true;
}
};
XMLDocumentCB.prototype.closeNode = function(node) {
if (!node.isClosed) {
this.onData(this.writer.closeNode(node, this.currentLevel));
return node.isClosed = true;
}
};
XMLDocumentCB.prototype.onData = function(chunk) {
this.documentStarted = true;
return this.onDataCallback(chunk);
};
XMLDocumentCB.prototype.onEnd = function() {
this.documentCompleted = true;
return this.onEndCallback();
};
XMLDocumentCB.prototype.ele = function() {
return this.element.apply(this, arguments);
};
XMLDocumentCB.prototype.nod = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLDocumentCB.prototype.txt = function(value) {
return this.text(value);
};
XMLDocumentCB.prototype.dat = function(value) {
return this.cdata(value);
};
XMLDocumentCB.prototype.com = function(value) {
return this.comment(value);
};
XMLDocumentCB.prototype.ins = function(target, value) {
return this.instruction(target, value);
};
XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
return this.declaration(version, encoding, standalone);
};
XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
return this.doctype(root, pubID, sysID);
};
XMLDocumentCB.prototype.e = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLDocumentCB.prototype.n = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLDocumentCB.prototype.t = function(value) {
return this.text(value);
};
XMLDocumentCB.prototype.d = function(value) {
return this.cdata(value);
};
XMLDocumentCB.prototype.c = function(value) {
return this.comment(value);
};
XMLDocumentCB.prototype.r = function(value) {
return this.raw(value);
};
XMLDocumentCB.prototype.i = function(target, value) {
return this.instruction(target, value);
};
XMLDocumentCB.prototype.att = function() {
if (this.currentNode && this.currentNode instanceof XMLDocType) {
return this.attList.apply(this, arguments);
} else {
return this.attribute.apply(this, arguments);
}
};
XMLDocumentCB.prototype.a = function() {
if (this.currentNode && this.currentNode instanceof XMLDocType) {
return this.attList.apply(this, arguments);
} else {
return this.attribute.apply(this, arguments);
}
};
XMLDocumentCB.prototype.ent = function(name, value) {
return this.entity(name, value);
};
XMLDocumentCB.prototype.pent = function(name, value) {
return this.pEntity(name, value);
};
XMLDocumentCB.prototype.not = function(name, value) {
return this.notation(name, value);
};
return XMLDocumentCB;
})();
}).call(this);

View File

@@ -0,0 +1,111 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLAttribute, XMLElement, XMLNode, isFunction, isObject, ref,
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;
ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction;
XMLNode = require('./XMLNode');
XMLAttribute = require('./XMLAttribute');
module.exports = XMLElement = (function(superClass) {
extend(XMLElement, superClass);
function XMLElement(parent, name, attributes) {
XMLElement.__super__.constructor.call(this, parent);
if (name == null) {
throw new Error("Missing element name");
}
this.name = this.stringify.eleName(name);
this.attributes = {};
if (attributes != null) {
this.attribute(attributes);
}
if (parent.isDocument) {
this.isRoot = true;
this.documentObject = parent;
parent.rootObject = this;
}
}
XMLElement.prototype.clone = function() {
var att, attName, clonedSelf, ref1;
clonedSelf = Object.create(this);
if (clonedSelf.isRoot) {
clonedSelf.documentObject = null;
}
clonedSelf.attributes = {};
ref1 = this.attributes;
for (attName in ref1) {
if (!hasProp.call(ref1, attName)) continue;
att = ref1[attName];
clonedSelf.attributes[attName] = att.clone();
}
clonedSelf.children = [];
this.children.forEach(function(child) {
var clonedChild;
clonedChild = child.clone();
clonedChild.parent = clonedSelf;
return clonedSelf.children.push(clonedChild);
});
return clonedSelf;
};
XMLElement.prototype.attribute = function(name, value) {
var attName, attValue;
if (name != null) {
name = name.valueOf();
}
if (isObject(name)) {
for (attName in name) {
if (!hasProp.call(name, attName)) continue;
attValue = name[attName];
this.attribute(attName, attValue);
}
} else {
if (isFunction(value)) {
value = value.apply();
}
if (!this.options.skipNullAttributes || (value != null)) {
this.attributes[name] = new XMLAttribute(this, name, value);
}
}
return this;
};
XMLElement.prototype.removeAttribute = function(name) {
var attName, i, len;
if (name == null) {
throw new Error("Missing attribute name");
}
name = name.valueOf();
if (Array.isArray(name)) {
for (i = 0, len = name.length; i < len; i++) {
attName = name[i];
delete this.attributes[attName];
}
} else {
delete this.attributes[name];
}
return this;
};
XMLElement.prototype.toString = function(options) {
return this.options.writer.set(options).element(this);
};
XMLElement.prototype.att = function(name, value) {
return this.attribute(name, value);
};
XMLElement.prototype.a = function(name, value) {
return this.attribute(name, value);
};
return XMLElement;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,432 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject, ref,
hasProp = {}.hasOwnProperty;
ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty;
XMLElement = null;
XMLCData = null;
XMLComment = null;
XMLDeclaration = null;
XMLDocType = null;
XMLRaw = null;
XMLText = null;
XMLProcessingInstruction = null;
module.exports = XMLNode = (function() {
function XMLNode(parent) {
this.parent = parent;
if (this.parent) {
this.options = this.parent.options;
this.stringify = this.parent.stringify;
}
this.children = [];
if (!XMLElement) {
XMLElement = require('./XMLElement');
XMLCData = require('./XMLCData');
XMLComment = require('./XMLComment');
XMLDeclaration = require('./XMLDeclaration');
XMLDocType = require('./XMLDocType');
XMLRaw = require('./XMLRaw');
XMLText = require('./XMLText');
XMLProcessingInstruction = require('./XMLProcessingInstruction');
}
}
XMLNode.prototype.element = function(name, attributes, text) {
var childNode, item, j, k, key, lastChild, len, len1, ref1, val;
lastChild = null;
if (attributes == null) {
attributes = {};
}
attributes = attributes.valueOf();
if (!isObject(attributes)) {
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}
if (name != null) {
name = name.valueOf();
}
if (Array.isArray(name)) {
for (j = 0, len = name.length; j < len; j++) {
item = name[j];
lastChild = this.element(item);
}
} else if (isFunction(name)) {
lastChild = this.element(name.apply());
} else if (isObject(name)) {
for (key in name) {
if (!hasProp.call(name, key)) continue;
val = name[key];
if (isFunction(val)) {
val = val.apply();
}
if ((isObject(val)) && (isEmpty(val))) {
val = null;
}
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
} else if (!this.options.separateArrayItems && Array.isArray(val)) {
for (k = 0, len1 = val.length; k < len1; k++) {
item = val[k];
childNode = {};
childNode[key] = item;
lastChild = this.element(childNode);
}
} else if (isObject(val)) {
lastChild = this.element(key);
lastChild.element(val);
} else {
lastChild = this.element(key, val);
}
}
} else {
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
lastChild = this.text(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
lastChild = this.cdata(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
lastChild = this.comment(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
lastChild = this.raw(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
} else {
lastChild = this.node(name, attributes, text);
}
}
if (lastChild == null) {
throw new Error("Could not create any elements with: " + name);
}
return lastChild;
};
XMLNode.prototype.insertBefore = function(name, attributes, text) {
var child, i, removed;
if (this.isRoot) {
throw new Error("Cannot insert elements at root level");
}
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i);
child = this.parent.element(name, attributes, text);
Array.prototype.push.apply(this.parent.children, removed);
return child;
};
XMLNode.prototype.insertAfter = function(name, attributes, text) {
var child, i, removed;
if (this.isRoot) {
throw new Error("Cannot insert elements at root level");
}
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i + 1);
child = this.parent.element(name, attributes, text);
Array.prototype.push.apply(this.parent.children, removed);
return child;
};
XMLNode.prototype.remove = function() {
var i, ref1;
if (this.isRoot) {
throw new Error("Cannot remove the root element");
}
i = this.parent.children.indexOf(this);
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1;
return this.parent;
};
XMLNode.prototype.node = function(name, attributes, text) {
var child, ref1;
if (name != null) {
name = name.valueOf();
}
attributes || (attributes = {});
attributes = attributes.valueOf();
if (!isObject(attributes)) {
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}
child = new XMLElement(this, name, attributes);
if (text != null) {
child.text(text);
}
this.children.push(child);
return child;
};
XMLNode.prototype.text = function(value) {
var child;
child = new XMLText(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.cdata = function(value) {
var child;
child = new XMLCData(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.comment = function(value) {
var child;
child = new XMLComment(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.commentBefore = function(value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i);
child = this.parent.comment(value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode.prototype.commentAfter = function(value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i + 1);
child = this.parent.comment(value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode.prototype.raw = function(value) {
var child;
child = new XMLRaw(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.instruction = function(target, value) {
var insTarget, insValue, instruction, j, len;
if (target != null) {
target = target.valueOf();
}
if (value != null) {
value = value.valueOf();
}
if (Array.isArray(target)) {
for (j = 0, len = target.length; j < len; j++) {
insTarget = target[j];
this.instruction(insTarget);
}
} else if (isObject(target)) {
for (insTarget in target) {
if (!hasProp.call(target, insTarget)) continue;
insValue = target[insTarget];
this.instruction(insTarget, insValue);
}
} else {
if (isFunction(value)) {
value = value.apply();
}
instruction = new XMLProcessingInstruction(this, target, value);
this.children.push(instruction);
}
return this;
};
XMLNode.prototype.instructionBefore = function(target, value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i);
child = this.parent.instruction(target, value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode.prototype.instructionAfter = function(target, value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i + 1);
child = this.parent.instruction(target, value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode.prototype.declaration = function(version, encoding, standalone) {
var doc, xmldec;
doc = this.document();
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
if (doc.children[0] instanceof XMLDeclaration) {
doc.children[0] = xmldec;
} else {
doc.children.unshift(xmldec);
}
return doc.root() || doc;
};
XMLNode.prototype.doctype = function(pubID, sysID) {
var child, doc, doctype, i, j, k, len, len1, ref1, ref2;
doc = this.document();
doctype = new XMLDocType(doc, pubID, sysID);
ref1 = doc.children;
for (i = j = 0, len = ref1.length; j < len; i = ++j) {
child = ref1[i];
if (child instanceof XMLDocType) {
doc.children[i] = doctype;
return doctype;
}
}
ref2 = doc.children;
for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {
child = ref2[i];
if (child.isRoot) {
doc.children.splice(i, 0, doctype);
return doctype;
}
}
doc.children.push(doctype);
return doctype;
};
XMLNode.prototype.up = function() {
if (this.isRoot) {
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
}
return this.parent;
};
XMLNode.prototype.root = function() {
var node;
node = this;
while (node) {
if (node.isDocument) {
return node.rootObject;
} else if (node.isRoot) {
return node;
} else {
node = node.parent;
}
}
};
XMLNode.prototype.document = function() {
var node;
node = this;
while (node) {
if (node.isDocument) {
return node;
} else {
node = node.parent;
}
}
};
XMLNode.prototype.end = function(options) {
return this.document().end(options);
};
XMLNode.prototype.prev = function() {
var i;
i = this.parent.children.indexOf(this);
if (i < 1) {
throw new Error("Already at the first node");
}
return this.parent.children[i - 1];
};
XMLNode.prototype.next = function() {
var i;
i = this.parent.children.indexOf(this);
if (i === -1 || i === this.parent.children.length - 1) {
throw new Error("Already at the last node");
}
return this.parent.children[i + 1];
};
XMLNode.prototype.importDocument = function(doc) {
var clonedRoot;
clonedRoot = doc.root().clone();
clonedRoot.parent = this;
clonedRoot.isRoot = false;
this.children.push(clonedRoot);
return this;
};
XMLNode.prototype.ele = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLNode.prototype.nod = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLNode.prototype.txt = function(value) {
return this.text(value);
};
XMLNode.prototype.dat = function(value) {
return this.cdata(value);
};
XMLNode.prototype.com = function(value) {
return this.comment(value);
};
XMLNode.prototype.ins = function(target, value) {
return this.instruction(target, value);
};
XMLNode.prototype.doc = function() {
return this.document();
};
XMLNode.prototype.dec = function(version, encoding, standalone) {
return this.declaration(version, encoding, standalone);
};
XMLNode.prototype.dtd = function(pubID, sysID) {
return this.doctype(pubID, sysID);
};
XMLNode.prototype.e = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLNode.prototype.n = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLNode.prototype.t = function(value) {
return this.text(value);
};
XMLNode.prototype.d = function(value) {
return this.cdata(value);
};
XMLNode.prototype.c = function(value) {
return this.comment(value);
};
XMLNode.prototype.r = function(value) {
return this.raw(value);
};
XMLNode.prototype.i = function(target, value) {
return this.instruction(target, value);
};
XMLNode.prototype.u = function() {
return this.up();
};
XMLNode.prototype.importXMLBuilder = function(doc) {
return this.importDocument(doc);
};
return XMLNode;
})();
}).call(this);

View File

@@ -0,0 +1,35 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLNode, XMLProcessingInstruction,
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;
XMLNode = require('./XMLNode');
module.exports = XMLProcessingInstruction = (function(superClass) {
extend(XMLProcessingInstruction, superClass);
function XMLProcessingInstruction(parent, target, value) {
XMLProcessingInstruction.__super__.constructor.call(this, parent);
if (target == null) {
throw new Error("Missing instruction target");
}
this.target = this.stringify.insTarget(target);
if (value) {
this.value = this.stringify.insValue(value);
}
}
XMLProcessingInstruction.prototype.clone = function() {
return Object.create(this);
};
XMLProcessingInstruction.prototype.toString = function(options) {
return this.options.writer.set(options).processingInstruction(this);
};
return XMLProcessingInstruction;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,32 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLNode, XMLRaw,
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;
XMLNode = require('./XMLNode');
module.exports = XMLRaw = (function(superClass) {
extend(XMLRaw, superClass);
function XMLRaw(parent, text) {
XMLRaw.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing raw text");
}
this.value = this.stringify.raw(text);
}
XMLRaw.prototype.clone = function() {
return Object.create(this);
};
XMLRaw.prototype.toString = function(options) {
return this.options.writer.set(options).raw(this);
};
return XMLRaw;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,278 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase,
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;
XMLDeclaration = require('./XMLDeclaration');
XMLDocType = require('./XMLDocType');
XMLCData = require('./XMLCData');
XMLComment = require('./XMLComment');
XMLElement = require('./XMLElement');
XMLRaw = require('./XMLRaw');
XMLText = require('./XMLText');
XMLProcessingInstruction = require('./XMLProcessingInstruction');
XMLDTDAttList = require('./XMLDTDAttList');
XMLDTDElement = require('./XMLDTDElement');
XMLDTDEntity = require('./XMLDTDEntity');
XMLDTDNotation = require('./XMLDTDNotation');
XMLWriterBase = require('./XMLWriterBase');
module.exports = XMLStreamWriter = (function(superClass) {
extend(XMLStreamWriter, superClass);
function XMLStreamWriter(stream, options) {
this.stream = stream;
XMLStreamWriter.__super__.constructor.call(this, options);
}
XMLStreamWriter.prototype.document = function(doc) {
var child, i, j, len, len1, ref, ref1, results;
ref = doc.children;
for (i = 0, len = ref.length; i < len; i++) {
child = ref[i];
child.isLastRootNode = false;
}
doc.children[doc.children.length - 1].isLastRootNode = true;
ref1 = doc.children;
results = [];
for (j = 0, len1 = ref1.length; j < len1; j++) {
child = ref1[j];
switch (false) {
case !(child instanceof XMLDeclaration):
results.push(this.declaration(child));
break;
case !(child instanceof XMLDocType):
results.push(this.docType(child));
break;
case !(child instanceof XMLComment):
results.push(this.comment(child));
break;
case !(child instanceof XMLProcessingInstruction):
results.push(this.processingInstruction(child));
break;
default:
results.push(this.element(child));
}
}
return results;
};
XMLStreamWriter.prototype.attribute = function(att) {
return this.stream.write(' ' + att.name + '="' + att.value + '"');
};
XMLStreamWriter.prototype.cdata = function(node, level) {
return this.stream.write(this.space(level) + '<![CDATA[' + node.text + ']]>' + this.endline(node));
};
XMLStreamWriter.prototype.comment = function(node, level) {
return this.stream.write(this.space(level) + '<!-- ' + node.text + ' -->' + this.endline(node));
};
XMLStreamWriter.prototype.declaration = function(node, level) {
this.stream.write(this.space(level));
this.stream.write('<?xml version="' + node.version + '"');
if (node.encoding != null) {
this.stream.write(' encoding="' + node.encoding + '"');
}
if (node.standalone != null) {
this.stream.write(' standalone="' + node.standalone + '"');
}
this.stream.write('?>');
return this.stream.write(this.endline(node));
};
XMLStreamWriter.prototype.docType = function(node, level) {
var child, i, len, ref;
level || (level = 0);
this.stream.write(this.space(level));
this.stream.write('<!DOCTYPE ' + node.root().name);
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.children.length > 0) {
this.stream.write(' [');
this.stream.write(this.endline(node));
ref = node.children;
for (i = 0, len = ref.length; i < len; i++) {
child = ref[i];
switch (false) {
case !(child instanceof XMLDTDAttList):
this.dtdAttList(child, level + 1);
break;
case !(child instanceof XMLDTDElement):
this.dtdElement(child, level + 1);
break;
case !(child instanceof XMLDTDEntity):
this.dtdEntity(child, level + 1);
break;
case !(child instanceof XMLDTDNotation):
this.dtdNotation(child, level + 1);
break;
case !(child instanceof XMLCData):
this.cdata(child, level + 1);
break;
case !(child instanceof XMLComment):
this.comment(child, level + 1);
break;
case !(child instanceof XMLProcessingInstruction):
this.processingInstruction(child, level + 1);
break;
default:
throw new Error("Unknown DTD node type: " + child.constructor.name);
}
}
this.stream.write(']');
}
this.stream.write('>');
return this.stream.write(this.endline(node));
};
XMLStreamWriter.prototype.element = function(node, level) {
var att, child, i, len, name, ref, ref1, space;
level || (level = 0);
space = this.space(level);
this.stream.write(space + '<' + node.name);
ref = node.attributes;
for (name in ref) {
if (!hasProp.call(ref, name)) continue;
att = ref[name];
this.attribute(att);
}
if (node.children.length === 0 || node.children.every(function(e) {
return e.value === '';
})) {
if (this.allowEmpty) {
this.stream.write('></' + node.name + '>');
} else {
this.stream.write('/>');
}
} else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {
this.stream.write('>');
this.stream.write(node.children[0].value);
this.stream.write('</' + node.name + '>');
} else {
this.stream.write('>' + this.newline);
ref1 = node.children;
for (i = 0, len = ref1.length; i < len; i++) {
child = ref1[i];
switch (false) {
case !(child instanceof XMLCData):
this.cdata(child, level + 1);
break;
case !(child instanceof XMLComment):
this.comment(child, level + 1);
break;
case !(child instanceof XMLElement):
this.element(child, level + 1);
break;
case !(child instanceof XMLRaw):
this.raw(child, level + 1);
break;
case !(child instanceof XMLText):
this.text(child, level + 1);
break;
case !(child instanceof XMLProcessingInstruction):
this.processingInstruction(child, level + 1);
break;
default:
throw new Error("Unknown XML node type: " + child.constructor.name);
}
}
this.stream.write(space + '</' + node.name + '>');
}
return this.stream.write(this.endline(node));
};
XMLStreamWriter.prototype.processingInstruction = function(node, level) {
this.stream.write(this.space(level) + '<?' + node.target);
if (node.value) {
this.stream.write(' ' + node.value);
}
return this.stream.write('?>' + this.endline(node));
};
XMLStreamWriter.prototype.raw = function(node, level) {
return this.stream.write(this.space(level) + node.value + this.endline(node));
};
XMLStreamWriter.prototype.text = function(node, level) {
return this.stream.write(this.space(level) + node.value + this.endline(node));
};
XMLStreamWriter.prototype.dtdAttList = function(node, level) {
this.stream.write(this.space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType);
if (node.defaultValueType !== '#DEFAULT') {
this.stream.write(' ' + node.defaultValueType);
}
if (node.defaultValue) {
this.stream.write(' "' + node.defaultValue + '"');
}
return this.stream.write('>' + this.endline(node));
};
XMLStreamWriter.prototype.dtdElement = function(node, level) {
return this.stream.write(this.space(level) + '<!ELEMENT ' + node.name + ' ' + node.value + '>' + this.endline(node));
};
XMLStreamWriter.prototype.dtdEntity = function(node, level) {
this.stream.write(this.space(level) + '<!ENTITY');
if (node.pe) {
this.stream.write(' %');
}
this.stream.write(' ' + node.name);
if (node.value) {
this.stream.write(' "' + node.value + '"');
} else {
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.nData) {
this.stream.write(' NDATA ' + node.nData);
}
}
return this.stream.write('>' + this.endline(node));
};
XMLStreamWriter.prototype.dtdNotation = function(node, level) {
this.stream.write(this.space(level) + '<!NOTATION ' + node.name);
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.pubID) {
this.stream.write(' PUBLIC "' + node.pubID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
return this.stream.write('>' + this.endline(node));
};
XMLStreamWriter.prototype.endline = function(node) {
if (!node.isLastRootNode) {
return this.newline;
} else {
return '';
}
};
return XMLStreamWriter;
})(XMLWriterBase);
}).call(this);

View File

@@ -0,0 +1,302 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase,
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;
XMLDeclaration = require('./XMLDeclaration');
XMLDocType = require('./XMLDocType');
XMLCData = require('./XMLCData');
XMLComment = require('./XMLComment');
XMLElement = require('./XMLElement');
XMLRaw = require('./XMLRaw');
XMLText = require('./XMLText');
XMLProcessingInstruction = require('./XMLProcessingInstruction');
XMLDTDAttList = require('./XMLDTDAttList');
XMLDTDElement = require('./XMLDTDElement');
XMLDTDEntity = require('./XMLDTDEntity');
XMLDTDNotation = require('./XMLDTDNotation');
XMLWriterBase = require('./XMLWriterBase');
module.exports = XMLStringWriter = (function(superClass) {
extend(XMLStringWriter, superClass);
function XMLStringWriter(options) {
XMLStringWriter.__super__.constructor.call(this, options);
}
XMLStringWriter.prototype.document = function(doc) {
var child, i, len, r, ref;
r = '';
ref = doc.children;
for (i = 0, len = ref.length; i < len; i++) {
child = ref[i];
r += (function() {
switch (false) {
case !(child instanceof XMLDeclaration):
return this.declaration(child);
case !(child instanceof XMLDocType):
return this.docType(child);
case !(child instanceof XMLComment):
return this.comment(child);
case !(child instanceof XMLProcessingInstruction):
return this.processingInstruction(child);
default:
return this.element(child, 0);
}
}).call(this);
}
if (this.pretty && r.slice(-this.newline.length) === this.newline) {
r = r.slice(0, -this.newline.length);
}
return r;
};
XMLStringWriter.prototype.attribute = function(att) {
return ' ' + att.name + '="' + att.value + '"';
};
XMLStringWriter.prototype.cdata = function(node, level) {
return this.space(level) + '<![CDATA[' + node.text + ']]>' + this.newline;
};
XMLStringWriter.prototype.comment = function(node, level) {
return this.space(level) + '<!-- ' + node.text + ' -->' + this.newline;
};
XMLStringWriter.prototype.declaration = function(node, level) {
var r;
r = this.space(level);
r += '<?xml version="' + node.version + '"';
if (node.encoding != null) {
r += ' encoding="' + node.encoding + '"';
}
if (node.standalone != null) {
r += ' standalone="' + node.standalone + '"';
}
r += '?>';
r += this.newline;
return r;
};
XMLStringWriter.prototype.docType = function(node, level) {
var child, i, len, r, ref;
level || (level = 0);
r = this.space(level);
r += '<!DOCTYPE ' + node.root().name;
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
if (node.children.length > 0) {
r += ' [';
r += this.newline;
ref = node.children;
for (i = 0, len = ref.length; i < len; i++) {
child = ref[i];
r += (function() {
switch (false) {
case !(child instanceof XMLDTDAttList):
return this.dtdAttList(child, level + 1);
case !(child instanceof XMLDTDElement):
return this.dtdElement(child, level + 1);
case !(child instanceof XMLDTDEntity):
return this.dtdEntity(child, level + 1);
case !(child instanceof XMLDTDNotation):
return this.dtdNotation(child, level + 1);
case !(child instanceof XMLCData):
return this.cdata(child, level + 1);
case !(child instanceof XMLComment):
return this.comment(child, level + 1);
case !(child instanceof XMLProcessingInstruction):
return this.processingInstruction(child, level + 1);
default:
throw new Error("Unknown DTD node type: " + child.constructor.name);
}
}).call(this);
}
r += ']';
}
r += '>';
r += this.newline;
return r;
};
XMLStringWriter.prototype.element = function(node, level) {
var att, child, i, len, name, r, ref, ref1, space;
level || (level = 0);
space = this.space(level);
r = '';
r += space + '<' + node.name;
ref = node.attributes;
for (name in ref) {
if (!hasProp.call(ref, name)) continue;
att = ref[name];
r += this.attribute(att);
}
if (node.children.length === 0 || node.children.every(function(e) {
return e.value === '';
})) {
if (this.allowEmpty) {
r += '></' + node.name + '>' + this.newline;
} else {
r += '/>' + this.newline;
}
} else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {
r += '>';
r += node.children[0].value;
r += '</' + node.name + '>' + this.newline;
} else {
r += '>' + this.newline;
ref1 = node.children;
for (i = 0, len = ref1.length; i < len; i++) {
child = ref1[i];
r += (function() {
switch (false) {
case !(child instanceof XMLCData):
return this.cdata(child, level + 1);
case !(child instanceof XMLComment):
return this.comment(child, level + 1);
case !(child instanceof XMLElement):
return this.element(child, level + 1);
case !(child instanceof XMLRaw):
return this.raw(child, level + 1);
case !(child instanceof XMLText):
return this.text(child, level + 1);
case !(child instanceof XMLProcessingInstruction):
return this.processingInstruction(child, level + 1);
default:
throw new Error("Unknown XML node type: " + child.constructor.name);
}
}).call(this);
}
r += space + '</' + node.name + '>' + this.newline;
}
return r;
};
XMLStringWriter.prototype.processingInstruction = function(node, level) {
var r;
r = this.space(level) + '<?' + node.target;
if (node.value) {
r += ' ' + node.value;
}
r += '?>' + this.newline;
return r;
};
XMLStringWriter.prototype.raw = function(node, level) {
return this.space(level) + node.value + this.newline;
};
XMLStringWriter.prototype.text = function(node, level) {
return this.space(level) + node.value + this.newline;
};
XMLStringWriter.prototype.dtdAttList = function(node, level) {
var r;
r = this.space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
if (node.defaultValueType !== '#DEFAULT') {
r += ' ' + node.defaultValueType;
}
if (node.defaultValue) {
r += ' "' + node.defaultValue + '"';
}
r += '>' + this.newline;
return r;
};
XMLStringWriter.prototype.dtdElement = function(node, level) {
return this.space(level) + '<!ELEMENT ' + node.name + ' ' + node.value + '>' + this.newline;
};
XMLStringWriter.prototype.dtdEntity = function(node, level) {
var r;
r = this.space(level) + '<!ENTITY';
if (node.pe) {
r += ' %';
}
r += ' ' + node.name;
if (node.value) {
r += ' "' + node.value + '"';
} else {
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
if (node.nData) {
r += ' NDATA ' + node.nData;
}
}
r += '>' + this.newline;
return r;
};
XMLStringWriter.prototype.dtdNotation = function(node, level) {
var r;
r = this.space(level) + '<!NOTATION ' + node.name;
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.pubID) {
r += ' PUBLIC "' + node.pubID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
r += '>' + this.newline;
return r;
};
XMLStringWriter.prototype.openNode = function(node, level) {
var att, name, r, ref;
level || (level = 0);
if (node instanceof XMLElement) {
r = this.space(level) + '<' + node.name;
ref = node.attributes;
for (name in ref) {
if (!hasProp.call(ref, name)) continue;
att = ref[name];
r += this.attribute(att);
}
r += (node.children ? '>' : '/>') + this.newline;
return r;
} else {
r = this.space(level) + '<!DOCTYPE ' + node.rootNodeName;
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
r += (node.children ? ' [' : '>') + this.newline;
return r;
}
};
XMLStringWriter.prototype.closeNode = function(node, level) {
level || (level = 0);
switch (false) {
case !(node instanceof XMLElement):
return this.space(level) + '</' + node.name + '>' + this.newline;
case !(node instanceof XMLDocType):
return this.space(level) + ']>' + this.newline;
}
};
return XMLStringWriter;
})(XMLWriterBase);
}).call(this);

View File

@@ -0,0 +1,192 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLStringifier, camelCase, kebabCase, ref, snakeCase, titleCase,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
hasProp = {}.hasOwnProperty;
ref = require('./Utility'), camelCase = ref.camelCase, titleCase = ref.titleCase, kebabCase = ref.kebabCase, snakeCase = ref.snakeCase;
module.exports = XMLStringifier = (function() {
function XMLStringifier(options) {
this.assertLegalChar = bind(this.assertLegalChar, this);
var key, ref1, value;
options || (options = {});
this.allowSurrogateChars = options.allowSurrogateChars;
this.noDoubleEncoding = options.noDoubleEncoding;
this.textCase = options.textCase;
ref1 = options.stringify || {};
for (key in ref1) {
if (!hasProp.call(ref1, key)) continue;
value = ref1[key];
this[key] = value;
}
}
XMLStringifier.prototype.eleName = function(val) {
val = '' + val || '';
val = this.applyCase(val);
return this.assertLegalChar(val);
};
XMLStringifier.prototype.eleText = function(val) {
val = '' + val || '';
return this.assertLegalChar(this.elEscape(val));
};
XMLStringifier.prototype.cdata = function(val) {
val = '' + val || '';
val = val.replace(']]>', ']]]]><![CDATA[>');
return this.assertLegalChar(val);
};
XMLStringifier.prototype.comment = function(val) {
val = '' + val || '';
if (val.match(/--/)) {
throw new Error("Comment text cannot contain double-hypen: " + val);
}
return this.assertLegalChar(val);
};
XMLStringifier.prototype.raw = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.attName = function(val) {
val = '' + val || '';
return val = this.applyCase(val);
};
XMLStringifier.prototype.attValue = function(val) {
val = '' + val || '';
return this.attEscape(val);
};
XMLStringifier.prototype.insTarget = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.insValue = function(val) {
val = '' + val || '';
if (val.match(/\?>/)) {
throw new Error("Invalid processing instruction value: " + val);
}
return val;
};
XMLStringifier.prototype.xmlVersion = function(val) {
val = '' + val || '';
if (!val.match(/1\.[0-9]+/)) {
throw new Error("Invalid version number: " + val);
}
return val;
};
XMLStringifier.prototype.xmlEncoding = function(val) {
val = '' + val || '';
if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/)) {
throw new Error("Invalid encoding: " + val);
}
return val;
};
XMLStringifier.prototype.xmlStandalone = function(val) {
if (val) {
return "yes";
} else {
return "no";
}
};
XMLStringifier.prototype.dtdPubID = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.dtdSysID = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.dtdElementValue = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.dtdAttType = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.dtdAttDefault = function(val) {
if (val != null) {
return '' + val || '';
} else {
return val;
}
};
XMLStringifier.prototype.dtdEntityValue = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.dtdNData = function(val) {
return '' + val || '';
};
XMLStringifier.prototype.convertAttKey = '@';
XMLStringifier.prototype.convertPIKey = '?';
XMLStringifier.prototype.convertTextKey = '#text';
XMLStringifier.prototype.convertCDataKey = '#cdata';
XMLStringifier.prototype.convertCommentKey = '#comment';
XMLStringifier.prototype.convertRawKey = '#raw';
XMLStringifier.prototype.assertLegalChar = function(str) {
var chars, chr;
if (this.allowSurrogateChars) {
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/;
} else {
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/;
}
chr = str.match(chars);
if (chr) {
throw new Error("Invalid character (" + chr + ") in string: " + str + " at index " + chr.index);
}
return str;
};
XMLStringifier.prototype.applyCase = function(str) {
switch (this.textCase) {
case "camel":
return camelCase(str);
case "title":
return titleCase(str);
case "kebab":
case "lower":
return kebabCase(str);
case "snake":
return snakeCase(str);
case "upper":
return kebabCase(str).toUpperCase();
default:
return str;
}
};
XMLStringifier.prototype.elEscape = function(str) {
var ampregex;
ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r/g, '&#xD;');
};
XMLStringifier.prototype.attEscape = function(str) {
var ampregex;
ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').replace(/\n/g, '&#xA;').replace(/\r/g, '&#xD;');
};
return XMLStringifier;
})();
}).call(this);

View File

@@ -0,0 +1,32 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLNode, XMLText,
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;
XMLNode = require('./XMLNode');
module.exports = XMLText = (function(superClass) {
extend(XMLText, superClass);
function XMLText(parent, text) {
XMLText.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing element text");
}
this.value = this.stringify.eleText(text);
}
XMLText.prototype.clone = function() {
return Object.create(this);
};
XMLText.prototype.toString = function(options) {
return this.options.writer.set(options).text(this);
};
return XMLText;
})(XMLNode);
}).call(this);

View File

@@ -0,0 +1,68 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLWriterBase,
hasProp = {}.hasOwnProperty;
module.exports = XMLWriterBase = (function() {
function XMLWriterBase(options) {
var key, ref, ref1, ref2, ref3, ref4, value;
options || (options = {});
this.pretty = options.pretty || false;
this.allowEmpty = (ref = options.allowEmpty) != null ? ref : false;
if (this.pretty) {
this.indent = (ref1 = options.indent) != null ? ref1 : ' ';
this.newline = (ref2 = options.newline) != null ? ref2 : '\n';
this.offset = (ref3 = options.offset) != null ? ref3 : 0;
} else {
this.indent = '';
this.newline = '';
this.offset = 0;
}
ref4 = options.writer || {};
for (key in ref4) {
if (!hasProp.call(ref4, key)) continue;
value = ref4[key];
this[key] = value;
}
}
XMLWriterBase.prototype.set = function(options) {
var key, ref, value;
options || (options = {});
if ("pretty" in options) {
this.pretty = options.pretty;
}
if ("allowEmpty" in options) {
this.allowEmpty = options.allowEmpty;
}
if (this.pretty) {
this.indent = "indent" in options ? options.indent : ' ';
this.newline = "newline" in options ? options.newline : '\n';
this.offset = "offset" in options ? options.offset : 0;
} else {
this.indent = '';
this.newline = '';
this.offset = 0;
}
ref = options.writer || {};
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
value = ref[key];
this[key] = value;
}
return this;
};
XMLWriterBase.prototype.space = function(level) {
if (this.pretty) {
return new Array((level || 0) + this.offset + 1).join(this.indent);
} else {
return '';
}
};
return XMLWriterBase;
})();
}).call(this);

View File

@@ -0,0 +1,53 @@
// Generated by CoffeeScript 1.10.0
(function() {
var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
XMLDocument = require('./XMLDocument');
XMLDocumentCB = require('./XMLDocumentCB');
XMLStringWriter = require('./XMLStringWriter');
XMLStreamWriter = require('./XMLStreamWriter');
module.exports.create = function(name, xmldec, doctype, options) {
var doc, root;
if (name == null) {
throw new Error("Root element needs a name");
}
options = assign({}, xmldec, doctype, options);
doc = new XMLDocument(options);
root = doc.element(name);
if (!options.headless) {
doc.declaration(options);
if ((options.pubID != null) || (options.sysID != null)) {
doc.doctype(options);
}
}
return root;
};
module.exports.begin = function(options, onData, onEnd) {
var ref1;
if (isFunction(options)) {
ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
options = {};
}
if (onData) {
return new XMLDocumentCB(options, onData, onEnd);
} else {
return new XMLDocument(options);
}
};
module.exports.stringWriter = function(options) {
return new XMLStringWriter(options);
};
module.exports.streamWriter = function(stream, options) {
return new XMLStreamWriter(stream, options);
};
}).call(this);

View File

@@ -0,0 +1,65 @@
{
"_from": "xmlbuilder@8.2.2",
"_id": "xmlbuilder@8.2.2",
"_inBundle": false,
"_integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=",
"_location": "/plist/xmlbuilder",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "xmlbuilder@8.2.2",
"name": "xmlbuilder",
"escapedName": "xmlbuilder",
"rawSpec": "8.2.2",
"saveSpec": null,
"fetchSpec": "8.2.2"
},
"_requiredBy": [
"/plist"
],
"_resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",
"_shasum": "69248673410b4ba42e1a6136551d2922335aa773",
"_spec": "xmlbuilder@8.2.2",
"_where": "F:\\projects\\p\\gitlit\\app\\node_modules\\plist",
"author": {
"name": "Ozgur Ozcitak",
"email": "oozcitak@gmail.com"
},
"bugs": {
"url": "http://github.com/oozcitak/xmlbuilder-js/issues"
},
"bundleDependencies": false,
"contributors": [],
"dependencies": {},
"deprecated": false,
"description": "An XML builder for node.js",
"devDependencies": {
"coffee-coverage": "*",
"coffee-script": "*",
"coveralls": "*",
"istanbul": "*",
"mocha": "*"
},
"engines": {
"node": ">=4.0"
},
"homepage": "http://github.com/oozcitak/xmlbuilder-js",
"keywords": [
"xml",
"xmlbuilder"
],
"license": "MIT",
"main": "./lib/index",
"name": "xmlbuilder",
"repository": {
"type": "git",
"url": "git://github.com/oozcitak/xmlbuilder-js.git"
},
"scripts": {
"postpublish": "rm -rf lib",
"prepublish": "coffee -co lib src",
"test": "mocha && istanbul report text lcov"
},
"version": "8.2.2"
}

85
app/node_modules/plist/package.json generated vendored Normal file
View File

@@ -0,0 +1,85 @@
{
"_from": "plist@^2.0.0",
"_id": "plist@2.1.0",
"_inBundle": false,
"_integrity": "sha1-V8zbeggh3yGDEhejytVOPhRqECU=",
"_location": "/plist",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "plist@^2.0.0",
"name": "plist",
"escapedName": "plist",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/electron-packager"
],
"_resolved": "https://registry.npmjs.org/plist/-/plist-2.1.0.tgz",
"_shasum": "57ccdb7a0821df21831217a3cad54e3e146a1025",
"_spec": "plist@^2.0.0",
"_where": "F:\\projects\\p\\gitlit\\app\\node_modules\\electron-packager",
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net"
},
"bugs": {
"url": "https://github.com/TooTallNate/node-plist/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Hans Huebner",
"email": "hans.huebner@gmail.com"
},
{
"name": "Pierre Metrailler"
},
{
"name": "Mike Reinstein",
"email": "reinstein.mike@gmail.com"
},
{
"name": "Vladimir Tsvang"
},
{
"name": "Mathieu D'Amours"
}
],
"dependencies": {
"base64-js": "1.2.0",
"xmlbuilder": "8.2.2",
"xmldom": "0.1.x"
},
"deprecated": false,
"description": "Mac OS X Plist parser/builder for Node.js and browsers",
"devDependencies": {
"browserify": "^14.3.0",
"mocha": "^3.3.0",
"multiline": "^1.0.2",
"zuul": "^3.10.1"
},
"homepage": "https://github.com/TooTallNate/node-plist#readme",
"keywords": [
"apple",
"browser",
"mac",
"plist",
"parser",
"xml"
],
"license": "MIT",
"main": "index.js",
"name": "plist",
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/node-plist.git"
},
"scripts": {
"test": "make test"
},
"version": "2.1.0"
}