| // Generated by CoffeeScript 1.6.3 |
| (function() { |
| var XMLDTDNotation, _; |
| |
| _ = require('lodash-node'); |
| |
| module.exports = XMLDTDNotation = (function() { |
| function XMLDTDNotation(parent, name, value) { |
| this.stringify = parent.stringify; |
| 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.clone = function() { |
| return _.create(XMLDTDNotation.prototype, this); |
| }; |
| |
| XMLDTDNotation.prototype.toString = function(options, level) { |
| var indent, newline, pretty, r, space; |
| pretty = (options != null ? options.pretty : void 0) || false; |
| indent = (options != null ? options.indent : void 0) || ' '; |
| newline = (options != null ? options.newline : void 0) || '\n'; |
| level || (level = 0); |
| space = new Array(level + 1).join(indent); |
| r = ''; |
| if (pretty) { |
| r += space; |
| } |
| r += '<!NOTATION ' + this.name; |
| if (this.pubID && this.sysID) { |
| r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; |
| } else if (this.pubID) { |
| r += ' PUBLIC "' + this.pubID + '"'; |
| } else if (this.sysID) { |
| r += ' SYSTEM "' + this.sysID + '"'; |
| } |
| r += '>'; |
| if (pretty) { |
| r += newline; |
| } |
| return r; |
| }; |
| |
| return XMLDTDNotation; |
| |
| })(); |
| |
| }).call(this); |