git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

XMLDTDNotation.js (1922B)


      1 // Generated by CoffeeScript 1.9.1
      2 (function() {
      3   var XMLDTDNotation, create;
      4 
      5   create = require('lodash/object/create');
      6 
      7   module.exports = XMLDTDNotation = (function() {
      8     function XMLDTDNotation(parent, name, value) {
      9       this.stringify = parent.stringify;
     10       if (name == null) {
     11         throw new Error("Missing notation name");
     12       }
     13       if (!value.pubID && !value.sysID) {
     14         throw new Error("Public or system identifiers are required for an external entity");
     15       }
     16       this.name = this.stringify.eleName(name);
     17       if (value.pubID != null) {
     18         this.pubID = this.stringify.dtdPubID(value.pubID);
     19       }
     20       if (value.sysID != null) {
     21         this.sysID = this.stringify.dtdSysID(value.sysID);
     22       }
     23     }
     24 
     25     XMLDTDNotation.prototype.clone = function() {
     26       return create(XMLDTDNotation.prototype, this);
     27     };
     28 
     29     XMLDTDNotation.prototype.toString = function(options, level) {
     30       var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
     31       pretty = (options != null ? options.pretty : void 0) || false;
     32       indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';
     33       offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
     34       newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
     35       level || (level = 0);
     36       space = new Array(level + offset + 1).join(indent);
     37       r = '';
     38       if (pretty) {
     39         r += space;
     40       }
     41       r += '<!NOTATION ' + this.name;
     42       if (this.pubID && this.sysID) {
     43         r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
     44       } else if (this.pubID) {
     45         r += ' PUBLIC "' + this.pubID + '"';
     46       } else if (this.sysID) {
     47         r += ' SYSTEM "' + this.sysID + '"';
     48       }
     49       r += '>';
     50       if (pretty) {
     51         r += newline;
     52       }
     53       return r;
     54     };
     55 
     56     return XMLDTDNotation;
     57 
     58   })();
     59 
     60 }).call(this);