This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.5 KiB
68 lines
2.5 KiB
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLDTDAttList, create; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
module.exports = XMLDTDAttList = (function() { |
|
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { |
|
this.stringify = parent.stringify; |
|
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, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!ATTLIST ' + this.elementName + ' ' + this.attributeName + ' ' + this.attributeType; |
|
if (this.defaultValueType !== '#DEFAULT') { |
|
r += ' ' + this.defaultValueType; |
|
} |
|
if (this.defaultValue) { |
|
r += ' "' + this.defaultValue + '"'; |
|
} |
|
r += '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLDTDAttList; |
|
|
|
})(); |
|
|
|
}).call(this);
|
|
|