From 4af970ed79e919a7d77ed22d9f4d36e5c9ea484e Mon Sep 17 00:00:00 2001
From: Jonathan Puckey ' + str.trim() + '..
-> ..
+ str = str.replace(/<(\/)*(code)>/g, '<$1pre>');
+
+ // ->
+ str = str.replace(/
/g, '
');
+
+ // {@link ...} -> html links
+ str = str.replace(/\{@link ([^} ]+) ?\}/gi,
+ function(match, symbolName) {
+ return new Link().toSymbol(symbolName.replace(/[\^]/g, '-'));
+ }
+ );
+ // {@code ...} -> code blocks
+ str = str.replace(/\{@code[\s]([^}]+)\}/gi,
+ function(match, code) {
+ return '' + code + '';
+ }
+ );
+
+ // {@true ...} -> true if.. false otherwise..
+ str = str.replace(/\{@true[\s]([^}]+)\}/gi,
+ function(match, text) {
+ return 'true ' + text + ', false otherwise';
+ }
+ );
+
+ var lineBreak = java.lang.System.getProperty('line.separator');
+
+ // Convert any type of lineBreak to the one we're using now:
+ str = str.replace(/(\r\n|\n|\r)/g, function(match, lineBreak) {
+ return lineBreak;
+ });
+
+ // Replace inline
with
+ str = str.replace(/
[ \t]*([^\n\r]*?)[ \t]*<\/code>/g, function(match, content) {
+ return '' + content + '';
+ });
+
+ // Put code and pre tags on the same line as the content, as white-space: pre is set:
+ str = str.replace(/(<(?:code|pre)>)\s*([\u0000-\uffff]*?)\s*(<\/(?:code|pre)>)/g, function(match, open, content, close) {
+ // Filter out the first white space at the beginning of each line, since
+ // that stems from the space after the * in the comment and replace
+ // with
, to fix a IE problem where lighter.js does not receive
+ // linebreaks from code tags weven when white-space: pre is set.
+ return '
' + content.replace(/(\r\n|\n|\r) /mg, function(match, lineBreak) {
+ return lineBreak;
+ }) + '
';
+ });
+ // Empty lines -> Paragraphs
+ if (!param.stripParagraphs) {
+ if (param.wrapInParagraphs === undefined || param.wrapInParagraphs)
+ str = '
'; + }); + // Automatically put
at the end of sentences with line breaks. + // Match following
andtags and swallow them. This happens when + // the original content contains these. + str = str.trim().replace(/([.:?!;])\s*(\r\n|\n|\r)(\s*)(<\/p>|
|)/g, function(match, before, lineBreak, whiteSpace, after) { + // Include following whiteSpace as well, since for code blocks they are relevant (e.g. indentation on new line) + return before + '
' + lineBreak + whiteSpace + ''; + }); + // Filter out
tags within and around \s*|)<(?:code|pre)[^>]*>[\u0000-\uffff]*<\/(?:code|pre)>(?:\s*<\/p>|))/g, function(match, code) {
+ return Utils.stripTags(code, 'p');
+ });
+ // Filter out empty paragraphs
+ str = str.replace(/ <\/p>/g, '');
+ }
+
+ return str;
+ };
+
+ /** Build output for displaying function parameters. */
+ var makeSignature = function(params) {
+ if (!params) return '()';
+ var postString = '';
+ var first = true;
+ params = params.filter(
+ function($) {
+ return $.name.indexOf('.') == -1; // don't show config params in signature
+ }
+ );
+ var signature = '';
+ var postSignature = '';
+ for (var i = 0, l = params.length; i < l; i++) {
+ var param = params[i];
+ if (param.isOptional) {
+ signature += '[';
+ postSignature += ']';
+ }
+ if (i > 0)
+ signature += ', ';
+ signature += param.name;
+ }
+ return '(' + signature + postSignature + ')';
+ };
+
+ return {
+ _class: function(symbol) {
+ var param = {
+ name: symbol.alias,
+ description: processInlineTags(symbol.classDesc),
+ symbol: symbol,
+ constructors: symbol.getConstructors(),
+ properties: symbol.getProperties(),
+ staticProperties: symbol.getStaticProperties(),
+ methods: symbol.getOwnMethods(),
+ staticMethods: symbol.getStaticMethods(),
+ showConstructors: (!(/(Event|Style)/).test(symbol.alias)
+ && !symbol.isNamespace && !symbol.ignore
+ && symbol.desc.length),
+ inheritedClasses: symbol.getInheritedClasses()
+ };
+ param.inheritedLinks = [];
+ for (var i in param.inheritedClasses) {
+ param.inheritedLinks.push(new Link().toSymbol(i));
+ }
+ param.inheritedLinks = param.inheritedLinks.join(', ');
+ // Add the grouped operators to param:
+ var operators = symbol.getOperators();
+ if (operators.length) {
+ param.operators = {};
+ for (var i = 0, l = operators.length; i < l; i++) {
+ var operator = operators[i];
+ var name = operator.name.replace(/\^[0-9]$/, '');
+ if (!param.operators[name])
+ param.operators[name] = [];
+ param.operators[name].push(operator);
+ }
+ }
+ publish.curClass = {
+ name: symbol.alias,
+ index: {
+ 'class': {
+ title: param.name,
+ text: param.description
+ }
+ }
+ };
+ publish.classes.push(publish.curClass);
+ return templates._class.process(param);
+ },
+ constructor: function(symbol) {
+ var param = {
+ symbol: symbol,
+ groupTitle: processGroupTitle(symbol),
+ id: symbol.getId(),
+ name: symbol.alias.replace(/(#|\^).+$/, ''),
+ description: processInlineTags(symbol.desc),
+ signature: makeSignature(symbol.params),
+ parameters: Render.parameters(symbol),
+ returns: Render.returns(symbol),
+ examples: Render.examples(symbol),
+ seeAlsos: Render.seeAlsos(symbol)
+ };
+ if (symbol.returns.length == 0) {
+ var type = symbol.memberOf ? symbol.memberOf : symbol.alias;
+ symbol.returns = [{type: type, desc: ''}];
+ }
+ publish.curClass.index[param.id] = {
+ title: param.name,
+ text: param.description
+ };
+ return templates.constructor.process(param);
+ },
+ method: function(symbol) {
+ var name = symbol.name.replace(/\^\d+$/, '');
+ if (symbol.isStatic)
+ name = symbol.memberOf + '.' + name;
+ var param = {
+ name: name,
+ groupTitle: processGroupTitle(symbol),
+ id: symbol.getId(),
+ signature: makeSignature(symbol.params),
+ description: processInlineTags(symbol.desc),
+ symbol: symbol
+ };
+ publish.curClass.index[param.id] = {
+ title: param.name,
+ text: param.description
+ };
+ return templates.method.process(param);
+ },
+ property: function(symbol) {
+ var name = symbol.name.replace(/\^\d+$/, '');
+ if (symbol.isStatic)
+ name = symbol.memberOf + '.' + name;
+ var param = {
+ name: name,
+ groupTitle: processGroupTitle(symbol),
+ id: symbol.getId(),
+ description: processInlineTags(symbol.desc),
+ symbol: symbol
+ };
+ publish.curClass.index[param.id] = {
+ title: param.name,
+ text: param.description
+ };
+ return templates.property.process(param);
+ },
+ parameters: function(symbol) {
+ return templates.parameters.process(symbol);
+ },
+ parameter: function(symbol) {
+ return templates.parameter.process({
+ name: symbol.name,
+ description: processInlineTags(symbol.desc,
+ {stripParagraphs: true}),
+ typeLink: new Link().toSymbol(symbol.type),
+ symbol: symbol
+ });
+ },
+ operators: function(symbols) {
+ var operatorCount = 0;
+ var title = [];
+ for (var i = 0, l = symbols.length; i < l; i++) {
+ var type = symbols[i].params[0].type;
+ type = type.charAt(0).toUpperCase() + type.slice(1);
+ title.push('' + Operator.getOperator(symbols[i]) + ' ' + type + '');
+ }
+
+ return templates.operators.process({
+ id: symbols[0].name.toLowerCase().replace(/\^[0-9]$/, ''),
+ title: title.join(', '),
+ operators: symbols
+ });
+ },
+ operator: function(symbol, id) {
+ var type = symbol.params[0].type;
+ return templates.operator.process({
+ id: id,
+ name: Operator.getOperator(symbol),
+ type: type.charAt(0).toUpperCase() + type.slice(1),
+ description: processInlineTags(symbol.desc),
+ symbol: symbol
+ });
+ },
+ returns: function(symbol) {
+ return templates.returns.process(symbol);
+ },
+ 'return': function(symbol) {
+ return templates['return'].process({
+ name: symbol.name,
+ description: processInlineTags(symbol.desc,
+ {stripParagraphs: true}),
+ typeLink: new Link().toSymbol(symbol.type),
+ symbol: symbol
+ });
+ },
+ seeAlsos: function(symbol) {
+ return templates.seeAlsos.process(symbol);
+ },
+ examples: function(symbol) {
+ var out = [],
+ examples = symbol.example;
+ for (var i = 0, l = examples.length; i < l; i++) {
+ var example = examples[i],
+ lines = example.toString().split('\n'),
+ description = [];
+ // The description is the first commented lines:
+ while (/^[\/]{2}/.test(lines[0])) {
+ description.push(lines.shift().replace('// ', ''));
+ }
+ out.push(Render.example({
+ description: description.join(' ').trim(),
+ code: lines.join('\n').trim()
+ }));
+ }
+ return out.join('\n');
+ },
+ example: function(param) {
+ return templates.example.process(param);
+ },
+ html: function(content) {
+ return templates.html.process(content);
+ },
+ allClasses: function(symbol) {
+ return templates.allClasses.process(symbol);
+ },
+ menu: function(html) {
+ return templates.menu.process(html);
+ },
+ packagesjs: function() {
+ return templates.packagesjs.process(publish.classes);
+ }
+ };
+};
\ No newline at end of file
diff --git a/build/jsdoc-toolkit/templates/jsdoc/Symbol.js b/build/jsdoc-toolkit/templates/jsdoc/Symbol.js
new file mode 100644
index 00000000..947bbc25
--- /dev/null
+++ b/build/jsdoc-toolkit/templates/jsdoc/Symbol.js
@@ -0,0 +1,78 @@
+JSDOC.Symbol.prototype.getId = function() {
+ var id = this.isConstructor
+ ? [this.alias.replace(/([#].+$|[\^][0-9])/g, '').toLowerCase()
+ .replace(/[.]/, '-')]
+ : [this.name.toLowerCase().replace(/[\^][0-9]/g, '')];
+ if (this.params) {
+ for (var i = 0, l = this.params.length; i < l; i++) {
+ var param = this.params[i];
+ if (!param.isOptional)
+ id.push(param.name);
+ }
+ }
+ return id.join('-');
+};
+
+JSDOC.Symbol.prototype.getOwnMethods = function(param) {
+ if (!param)
+ param = {};
+ return this.methods.filter(function($) {
+ return $.memberOf == this.alias && !$.isNamespace
+ && (param.operators ? $.isOperator : !$.isOperator)
+ && (param.constructors ? $.isConstructor : !$.isConstructor)
+ && (param.statics ? $.isStatic : !$.isStatic);
+ }, this);
+};
+
+JSDOC.Symbol.prototype.getOperators = function() {
+ return this.getOwnMethods({
+ operators: true
+ });
+};
+
+JSDOC.Symbol.prototype.getStaticMethods = function() {
+ return this.getOwnMethods({
+ statics: true
+ });
+};
+
+JSDOC.Symbol.prototype.getConstructors = function() {
+ return [this].concat(this.getOwnMethods({
+ constructors: true
+ }));
+};
+
+JSDOC.Symbol.prototype.getProperties = function(param) {
+ if (!param)
+ param = {};
+ return this.properties.filter(function($) {
+ return $.memberOf == this.alias && !$.isNamespace && !$.isConstructor
+ && (param.statics ? $.isStatic : !$.isStatic);
+ }, this);
+};
+
+JSDOC.Symbol.prototype.getStaticProperties = function() {
+ return this.getProperties({
+ statics: true
+ });
+};
+
+JSDOC.Symbol.prototype.getInheritedClasses = function() {
+ var inheritedClasses = {};
+ var addInherited = function(symbol) {
+ if (symbol.memberOf != this.alias) {
+ var _class = inheritedClasses[symbol.memberOf];
+ if (!_class) {
+ _class = inheritedClasses[symbol.memberOf] = {
+ className: symbol.memberOf,
+ properties: [],
+ methods: []
+ };
+ }
+ _class[symbol.isa == "OBJECT" ? 'properties' : 'methods'].push(symbol);
+ }
+ };
+ this.properties.map(addInherited, this);
+ this.methods.map(addInherited, this);
+ return inheritedClasses;
+};
\ No newline at end of file
diff --git a/build/jsdoc-toolkit/templates/jsdoc/Utils.js b/build/jsdoc-toolkit/templates/jsdoc/Utils.js
new file mode 100644
index 00000000..5b937673
--- /dev/null
+++ b/build/jsdoc-toolkit/templates/jsdoc/Utils.js
@@ -0,0 +1,109 @@
+var Utils = {
+ isaClass: function(symbol) {
+ return symbol.is('CONSTRUCTOR') || symbol.isNamespace;
+ },
+
+ stripTags: function(str, tag) {
+ var tag = tag || '.*?'; // Default: all tags
+ return str.replace(new RegExp('<' + tag + '>|' + tag + '>', 'g'), '');
+ },
+
+ copyDirectory: function(sourceLocation, targetLocation) {
+ if (sourceLocation.isDirectory()) {
+ if (!targetLocation.exists()) {
+ targetLocation.mkdir();
+ }
+
+ var children = sourceLocation.list();
+ for (var i = 0; i < children.length; i++) {
+ Utils.copyDirectory(new File(sourceLocation, children[i]),
+ new File(targetLocation, children[i]));
+ }
+ } else {
+ // Copy the file with FileChannels:
+ targetLocation.createNewFile();
+ var src = new java.io.FileInputStream(sourceLocation).getChannel();
+ var dst = new java.io.FileOutputStream(targetLocation).getChannel();
+ var amount = dst.transferFrom(src, 0, src.size());
+ src.close();
+ dst.close();
+ }
+ },
+
+ deleteFiles: function(path) {
+ if (path.isDirectory()) {
+ var files = path.listFiles();
+ for (var i = 0, l = files.length; i < l; i++) {
+ Utils.deleteFiles(files[i]);
+ }
+ }
+ if (!path['delete']())
+ throw Error('Could not delete ' + path);
+ },
+
+ publishMenu: function() {
+ load(JSDOC.opt.t + 'classLayout.js');
+ function parseClassNames(classNames) {
+ var out = '';
+ for (var i = 0, l = classNames.length; i < l; i++) {
+ if (typeof classNames[i] == 'string') {
+ var name = classNames[i];
+ out += (name == 'ruler') ? getRuler() : getLink(name);
+ } else {
+ for (var j in classNames[i]) {
+ out += getHeading(j);
+ out += parseClassNames(classNames[i][j]);
+ }
+ }
+ }
+ return out;
+ }
+ function getLink(name) {
+ var link = name;
+ if (name.indexOf(':') > 0) {
+ var names = name.split(':');
+ name = names[0];
+ link = names[1];
+ }
+ return ' ' + str.trim() + ' and
blocks again
+ str = str.replace(/((?:
' + title + '
';
+ for (var i in classLayout) {
+ out += '
';
+
+ var classesIndex = Render.menu(out);
+ IO.saveFile(publish.conf.packagesDir, 'packages.html', classesIndex);
+ },
+
+ makeSortby: function(attribute) {
+ return function(a, b) {
+ if (a[attribute] != undefined && b[attribute] != undefined) {
+ a = a[attribute].toLowerCase();
+ b = b[attribute].toLowerCase();
+ if (a < b) return -1;
+ if (a > b) return 1;
+ return 0;
+ }
+ };
+ },
+
+ /** Pull in the contents of an external file at the given path. */
+ include: function(path) {
+ var path = publish.conf.templateDir + path;
+ return IO.readFile(path);
+ }
+};
\ No newline at end of file
diff --git a/build/jsdoc-toolkit/templates/jsdoc/publish.js b/build/jsdoc-toolkit/templates/jsdoc/publish.js
index d7c05d45..419c99ee 100644
--- a/build/jsdoc-toolkit/templates/jsdoc/publish.js
+++ b/build/jsdoc-toolkit/templates/jsdoc/publish.js
@@ -1,4 +1,9 @@
/** Called automatically by JsDoc Toolkit. */
+load(JSDOC.opt.t + 'Symbol.js');
+load(JSDOC.opt.t + 'Utils.js');
+load(JSDOC.opt.t + 'Operator.js');
+load(JSDOC.opt.t + 'Render.js');
+
function publish(symbolSet) {
var renderMode = JSDOC.opt.D.renderMode;
publish.conf = { // trailing slash expected for dirs
@@ -11,27 +16,7 @@ function publish(symbolSet) {
renderMode: renderMode
};
publish.conf.packagesDir = publish.conf.outDir + publish.conf.symbolsDir;
- var templatesDir = publish.conf.templateDir + 'templates/';
- publish.templates = {
- _class: 'class.tmpl',
- method: 'method.tmpl',
- property: 'property.tmpl',
- parameters: 'parameters.tmpl',
- operators: 'operators.tmpl',
- returns: 'returns.tmpl',
- seeAlsos: 'see-alsos.tmpl',
- example: 'example.tmpl',
- constructor: 'constructor.tmpl',
- html: 'html.tmpl',
- allClasses: 'allClasses.tmpl',
- menu: 'packages.tmpl'
- };
- for (var i in publish.templates) {
- publish.templates[i] = new JSDOC.JsPlate(templatesDir +
- publish.templates[i]);
- }
-
if (renderMode == 'docs') {
// Copy over the static files
Utils.copyDirectory(
@@ -84,11 +69,11 @@ function publish(symbolSet) {
}
Link.currentSymbol= symbol;
- var html = publish.templates._class.process(symbol);
+ var html = Render._class(symbol);
var name = ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias)
+ publish.conf.ext;
if (renderMode == 'docs') {
- html = publish.templates.html.process({
+ html = Render.html({
content: html,
title: symbol.alias
});
@@ -97,298 +82,7 @@ function publish(symbolSet) {
}
if (renderMode == 'docs')
Utils.publishMenu();
-}
-
-var Operator = new function() {
- var operators = {
- add: '+', subtract: '-', multiply: '*', divide: '/', equals: '==',
- modulo: '%'
- };
- var operatorNames = {
- add: 'Addition', subtract: 'Subtraction', multiply: 'Multiplication',
- divide: 'Division', equals: 'Comparison', modulo: 'Modulo'
- };
-
- return {
- isOperator: function(symbol) {
- // As a convention, only add non static bean properties to
- // the documentation. static properties are all supposed to
- // be uppercase and constants.
- return symbol.params.length == 1 && !symbol.isStatic && (
- /^(add|subtract|multiply|divide|modulo)(\^[0-9])*$/.test(symbol.name)
- && (symbol.operator != 'none')
- ) || ( // equals
- symbol.name == 'equals'
- && symbol.returns.length && symbol.returns[0].type == 'boolean'
- );
- },
-
- getOperator: function(symbol) {
- return operators[symbol.name.replace(/\^[0-9]$/,'')];
- }
- };
-};
-
-var Utils = {
- getSymbolId: function(symbol) {
- var id = [symbol.name.toLowerCase().replace(/[\^][0-9]/g, '')];
- if (symbol.params) {
- for (var i = 0, l = symbol.params.length; i < l; i++) {
- var param = symbol.params[i];
- if (!param.isOptional)
- id.push(param.name);
- }
- }
- return id.join('-');
- },
-
- getConstructorId: function(symbol) {
- var id = [symbol.alias.replace(/([#].+$|[\^][0-9])/g, '').toLowerCase()
- .replace(/[.]/, '-')];
- if (symbol.params) {
- for (var i = 0, l = symbol.params.length; i < l; i++) {
- var param = symbol.params[i];
- if (!param.isOptional)
- id.push(param.name);
- }
- }
- return id.join('-');
- },
-
- isaClass: function(symbol) {
- return symbol.is('CONSTRUCTOR') || symbol.isNamespace;
- },
-
- parseExamples: function(symbol) {
- var out = [],
- examples = symbol.example;
- for (var i = 0, l = examples.length; i < l; i++) {
- var example = examples[i],
- lines = example.toString().split('\n'),
- description = [];
- // The description is the first commented lines:
- while (/^[\/]{2}/.test(lines[0])) {
- description.push(lines.shift().replace('// ', ''));
- }
- out.push(publish.templates.example.process({
- description: description.join(' ').trim(),
- code: lines.join('\n').trim()
- }));
- }
- return out.join('\n');
- },
-
- stripTags: function(str, tag) {
- var tag = tag || '.*?'; // Default: all tags
- return str.replace(new RegExp('<' + tag + '>|' + tag + '>', 'g'), '');
- },
-
- copyDirectory: function(sourceLocation, targetLocation) {
- if (sourceLocation.isDirectory()) {
- if (!targetLocation.exists()) {
- targetLocation.mkdir();
- }
-
- var children = sourceLocation.list();
- for (var i = 0; i < children.length; i++) {
- Utils.copyDirectory(new File(sourceLocation, children[i]),
- new File(targetLocation, children[i]));
- }
- } else {
- // Copy the file with FileChannels:
- targetLocation.createNewFile();
- var src = new java.io.FileInputStream(sourceLocation).getChannel();
- var dst = new java.io.FileOutputStream(targetLocation).getChannel();
- var amount = dst.transferFrom(src, 0, src.size());
- src.close();
- dst.close();
- }
- },
-
- deleteFiles: function(path) {
- if (path.isDirectory()) {
- var files = path.listFiles();
- for (var i = 0, l = files.length; i < l; i++) {
- Utils.deleteFiles(files[i]);
- }
- }
- if (!path['delete']())
- throw Error('Could not delete ' + path);
- },
-
- processGroupTitle: function(str, symbol) {
- var groupTitle = str.match(/\{@grouptitle ([^}]+)\}/);
- if (groupTitle) {
- symbol.groupTitle = groupTitle[1];
- str = str.replace(/\{@grouptitle ([^}]+)\}/, '');
- }
- return str;
- },
-
- publishMenu: function() {
- load(JSDOC.opt.t + 'classLayout.js');
- function parseClassNames(classNames) {
- var out = '';
- for (var i = 0, l = classNames.length; i < l; i++) {
- if (typeof classNames[i] == 'string') {
- var name = classNames[i];
- out += (name == 'ruler') ? getRuler() : getLink(name);
- } else {
- for (var j in classNames[i]) {
- out += getHeading(j);
- out += parseClassNames(classNames[i][j]);
- }
- }
- }
- return out;
- }
- function getLink(name) {
- var link = name;
- if (name.indexOf(':') > 0) {
- var names = name.split(':');
- name = names[0];
- link = names[1];
- }
- return '' + i + '
' + title + '
';
- for (var i in classLayout) {
- out += '
';
-
- var classesIndex = publish.templates.menu.process(out);
- IO.saveFile(publish.conf.packagesDir, 'packages.html', classesIndex);
- },
-
- makeSortby: function(attribute) {
- return function(a, b) {
- if (a[attribute] != undefined && b[attribute] != undefined) {
- a = a[attribute].toLowerCase();
- b = b[attribute].toLowerCase();
- if (a < b) return -1;
- if (a > b) return 1;
- return 0;
- }
- };
- },
-
- /** Pull in the contents of an external file at the given path. */
- include: function(path) {
- var path = publish.conf.templateDir + path;
- return IO.readFile(path);
- },
-
- processInlineTags: function(str, param) {
- if (!param)
- param = {};
- // ' + i + '
..
-> ..
- str = str.replace(/<(\/)*(code)>/g, '<$1pre>');
-
- // ->
- str = str.replace(/
/g, '
');
-
- // {@link ...} -> html links
- str = str.replace(/\{@link ([^} ]+) ?\}/gi,
- function(match, symbolName) {
- return new Link().toSymbol(symbolName.replace(/[\^]/g, '-'));
- }
- );
- // {@code ...} -> code blocks
- str = str.replace(/\{@code[\s]([^}]+)\}/gi,
- function(match, code) {
- return '' + code + '';
- }
- );
-
- // {@true ...} -> true if.. false otherwise..
- str = str.replace(/\{@true[\s]([^}]+)\}/gi,
- function(match, text) {
- return 'true ' + text + ', false otherwise';
- }
- );
-
- var lineBreak = java.lang.System.getProperty('line.separator');
-
- // Convert any type of lineBreak to the one we're using now:
- str = str.replace(/(\r\n|\n|\r)/g, function(match, lineBreak) {
- return lineBreak;
- });
-
- // Replace inline
with
- str = str.replace(/
[ \t]*([^\n\r]*?)[ \t]*<\/code>/g, function(match, content) {
- return '' + content + '';
- });
-
- // Put code and pre tags on the same line as the content, as white-space: pre is set:
- str = str.replace(/(<(?:code|pre)>)\s*([\u0000-\uffff]*?)\s*(<\/(?:code|pre)>)/g, function(match, open, content, close) {
- // Filter out the first white space at the beginning of each line, since
- // that stems from the space after the * in the comment and replace
- // with
, to fix a IE problem where lighter.js does not receive
- // linebreaks from code tags weven when white-space: pre is set.
- return '
' + content.replace(/(\r\n|\n|\r) /mg, function(match, lineBreak) {
- return lineBreak;
- }) + '
';
- });
- // Empty lines -> Paragraphs
- if (!param.stripParagraphs) {
- if (param.wrapInParagraphs === undefined || param.wrapInParagraphs)
- str = '
'; - }); - // Automatically put
at the end of sentences with line breaks. - // Match following
andtags and swallow them. This happens when - // the original content contains these. - str = str.trim().replace(/([.:?!;])\s*(\r\n|\n|\r)(\s*)(<\/p>|
|)/g, function(match, before, lineBreak, whiteSpace, after) { - // Include following whiteSpace as well, since for code blocks they are relevant (e.g. indentation on new line) - return before + '
' + lineBreak + whiteSpace + ''; - }); - // Filter out
tags within and around \s*|)<(?:code|pre)[^>]*>[\u0000-\uffff]*<\/(?:code|pre)>(?:\s*<\/p>|))/g, function(match, code) {
- return Utils.stripTags(code, 'p');
- });
- // Filter out empty paragraphs
- str = str.replace(/ <\/p>/g, '');
- }
-
- return str;
- },
-
- /** Build output for displaying function parameters. */
- makeSignature: function(params) {
- if (!params) return '()';
- var postString = '';
- var first = true;
- params = params.filter(
- function($) {
- return $.name.indexOf('.') == -1; // don't show config params in signature
- }
- );
- var signature = '';
- var postSignature = '';
- for (var i = 0, l = params.length; i < l; i++) {
- var param = params[i];
- if (param.isOptional) {
- signature += '[';
- postSignature += ']';
- }
- if (i > 0)
- signature += ', ';
- signature += param.name;
- }
- return '(' + signature + postSignature + ')';
+ if (renderMode == 'templatedocs') {
+ IO.saveFile(publish.conf.outDir, 'packages.js', Render.packagesjs());
}
-};
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/build/jsdoc-toolkit/templates/jsdoc/templates/class.tmpl b/build/jsdoc-toolkit/templates/jsdoc/templates/class.tmpl
index 16b92834..ed524df7 100644
--- a/build/jsdoc-toolkit/templates/jsdoc/templates/class.tmpl
+++ b/build/jsdoc-toolkit/templates/jsdoc/templates/class.tmpl
@@ -1,102 +1,57 @@
-{!
- data.classId = data.alias.toLowerCase();
- var constructors = data.methods.filter(function($){return $.memberOf == data.alias && $.isConstructor});
- var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace && !$.isStatic && !$.isConstructor});
- var staticProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace && $.isStatic && !$.isConstructor});
- var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace && !$.isStatic && !$.isOperator && !$.isConstructor});
- var staticMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace && $.isStatic && !$.isOperator && !$.isConstructor});
- var operatorMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace && !$.isStatic && !$.isConstructor && $.isOperator});
- if (operatorMethods.length) {
- var operators = {};
- for (var i = 0, l = operatorMethods.length; i < l; i++) {
- var operator = operatorMethods[i];
- var name = operator.name.replace(/\^[0-9]$/, '');
- if (!operators[name])
- operators[name] = [];
- operators[name].push(operator);
- }
- }
-
- var inheritedProperties = data.properties.filter(function($) {return $.memberOf != data.alias});
- var inheritedMethods = data.methods.filter(function($) {return $.memberOf != data.alias});
- var inheritedClasses = {};
- var inheritedClassLinks = [];
- inheritedProperties.concat(inheritedMethods).map(function($) {
- if (!inheritedClasses[$.memberOf]) {
- inheritedClassLinks.push(new Link().toSymbol($.memberOf));
- inheritedClasses[$.memberOf] = {
- className: $.memberOf,
- properties: [],
- methods: []
- };
- }
- });
-
- for (var i = 0, l = inheritedProperties.length; i < l; i++) {
- var symbol = inheritedProperties[i];
- inheritedClasses[symbol.memberOf].properties.push(symbol);
- }
-
- for (var i = 0, l = inheritedMethods.length; i < l; i++) {
- var symbol = inheritedMethods[i];
- inheritedClasses[symbol.memberOf].methods.push(symbol);
- }
-!}
Extends {+ inheritedClassLinks.join(', ') +} Extends {+ data.inheritedLinks +} and
blocks again
- str = str.replace(/((?:
{+data.alias+}
{+ data.name +}
Constructors
- {+ publish.templates.constructor.process(data) +}
- Operators
- Properties
- Functions
- Static Functions
- Properties inherited from {+ new Link().toSymbol(inheritedClass.className) +}
Functions inherited from {+ new Link().toSymbol(inheritedClass.className) +}
{+data.groupTitle+}
{+data.symbol.groupTitle+}