clean-jsdoc-theme 4.1.9 → 4.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -22
- package/clean-jsdoc-theme-defaults.js +37 -0
- package/clean-jsdoc-theme-helper.js +167 -0
- package/jsdoc-config.json +1 -0
- package/package.json +54 -50
- package/publish.js +295 -421
- package/static/scripts/core.min.js +22 -22
- package/tmpl/container.tmpl +26 -10
- package/tmpl/method.tmpl +19 -0
- package/tmpl/params.tmpl +8 -1
- package/tmpl/type.tmpl +5 -4
package/publish.js
CHANGED
|
@@ -1,101 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const commonPathPrefix = require('common-path-prefix');
|
|
3
|
+
const env = require('jsdoc/env');
|
|
4
|
+
const fs = require('jsdoc/fs');
|
|
5
|
+
const helper = require('jsdoc/util/templateHelper');
|
|
6
|
+
const logger = require('jsdoc/util/logger');
|
|
7
|
+
const path = require('jsdoc/path');
|
|
8
|
+
const { taffy } = require('@jsdoc/salty');
|
|
9
|
+
const template = require('jsdoc/template');
|
|
10
|
+
const nanoid = require('nanoid').nanoid;
|
|
11
|
+
const htmlMinify = require('html-minifier');
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
buildFooter,
|
|
15
|
+
codepen,
|
|
16
|
+
createDynamicStyleSheet,
|
|
17
|
+
createDynamicsScripts,
|
|
18
|
+
getBaseURL,
|
|
19
|
+
getFavicon,
|
|
20
|
+
getMetaTagData,
|
|
21
|
+
getTheme,
|
|
22
|
+
includeCss,
|
|
23
|
+
includeScript,
|
|
24
|
+
moduleHeader,
|
|
25
|
+
resizeable,
|
|
26
|
+
returnPathOfScriptScr,
|
|
27
|
+
returnPathOfStyleSrc,
|
|
28
|
+
copyStaticFolder,
|
|
29
|
+
getProcessedYield,
|
|
30
|
+
} = require('./clean-jsdoc-theme-helper');
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
HTML_MINIFY_OPTIONS,
|
|
34
|
+
SECTION_TYPE,
|
|
35
|
+
defaultSections,
|
|
36
|
+
} = require('./clean-jsdoc-theme-defaults');
|
|
37
|
+
|
|
38
|
+
const htmlsafe = helper.htmlsafe;
|
|
39
|
+
const linkto = helper.linkto;
|
|
40
|
+
const resolveAuthorLinks = helper.resolveAuthorLinks;
|
|
41
|
+
const hasOwnProp = Object.prototype.hasOwnProperty;
|
|
42
|
+
|
|
43
|
+
const themeOpts = (env && env.opts && env.opts.theme_opts) || {};
|
|
44
|
+
|
|
45
|
+
let data;
|
|
46
|
+
let view;
|
|
47
|
+
const searchListArray = [];
|
|
48
|
+
const hasSearch =
|
|
29
49
|
themeOpts.search === undefined ? true : Boolean(themeOpts.search);
|
|
30
50
|
|
|
31
51
|
// eslint-disable-next-line no-restricted-globals
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var SECTION_TYPE = {
|
|
35
|
-
Classes: 'Classes',
|
|
36
|
-
Modules: 'Modules',
|
|
37
|
-
Externals: 'Externals',
|
|
38
|
-
Events: 'Events',
|
|
39
|
-
Namespaces: 'Namespaces',
|
|
40
|
-
Mixins: 'Mixins',
|
|
41
|
-
Tutorials: 'Tutorials',
|
|
42
|
-
Interfaces: 'Interfaces',
|
|
43
|
-
Global: 'Global'
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var defaultSections = [
|
|
47
|
-
SECTION_TYPE.Modules,
|
|
48
|
-
SECTION_TYPE.Classes,
|
|
49
|
-
SECTION_TYPE.Externals,
|
|
50
|
-
SECTION_TYPE.Events,
|
|
51
|
-
SECTION_TYPE.Namespaces,
|
|
52
|
-
SECTION_TYPE.Mixins,
|
|
53
|
-
SECTION_TYPE.Tutorials,
|
|
54
|
-
SECTION_TYPE.Interfaces,
|
|
55
|
-
SECTION_TYPE.Global
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
var HTML_MINIFY_OPTIONS = {
|
|
59
|
-
collapseWhitespace: true,
|
|
60
|
-
removeComments: true,
|
|
61
|
-
html5: true,
|
|
62
|
-
minifyJS: true,
|
|
63
|
-
minifyCSS: true
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
function copyStaticFolder() {
|
|
67
|
-
var staticDir = themeOpts.static_dir || undefined;
|
|
68
|
-
|
|
69
|
-
if (staticDir) {
|
|
70
|
-
for (var i = 0; i < staticDir.length; i++) {
|
|
71
|
-
var output = path.join(outdir, staticDir[i]);
|
|
72
|
-
|
|
73
|
-
fse.copySync(staticDir[i], output);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
copyStaticFolder();
|
|
79
|
-
|
|
80
|
-
function copyToOutputFolder(filePath) {
|
|
81
|
-
var filePathNormalized = path.normalize(filePath);
|
|
82
|
-
|
|
83
|
-
fs.copyFileSync(filePathNormalized, outdir);
|
|
84
|
-
}
|
|
52
|
+
let outdir = path.normalize(env.opts.destination);
|
|
85
53
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var outputList = [];
|
|
89
|
-
|
|
90
|
-
if (Array.isArray(filePathArray)) {
|
|
91
|
-
for (; i < filePathArray.length; i++) {
|
|
92
|
-
copyToOutputFolder(filePathArray[i]);
|
|
93
|
-
outputList.push(path.basename(filePathArray[i]));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return outputList;
|
|
98
|
-
}
|
|
54
|
+
// copy static folders
|
|
55
|
+
copyStaticFolder(themeOpts, outdir);
|
|
99
56
|
|
|
100
57
|
function find(spec) {
|
|
101
58
|
return helper.find(data, spec);
|
|
@@ -105,7 +62,7 @@ function tutoriallink(tutorial) {
|
|
|
105
62
|
return helper.toTutorial(tutorial, null, {
|
|
106
63
|
tag: 'em',
|
|
107
64
|
classname: 'disabled',
|
|
108
|
-
prefix: 'Tutorial: '
|
|
65
|
+
prefix: 'Tutorial: ',
|
|
109
66
|
});
|
|
110
67
|
}
|
|
111
68
|
|
|
@@ -113,53 +70,62 @@ function getAncestorLinks(doclet) {
|
|
|
113
70
|
return helper.getAncestorLinks(data, doclet);
|
|
114
71
|
}
|
|
115
72
|
|
|
116
|
-
function hashToLink(doclet, hash) {
|
|
73
|
+
function hashToLink(doclet, hash, dependencies) {
|
|
74
|
+
let url;
|
|
75
|
+
|
|
117
76
|
if (!/^(#.+)/.test(hash)) {
|
|
118
77
|
return hash;
|
|
119
78
|
}
|
|
120
79
|
|
|
121
|
-
|
|
122
|
-
|
|
80
|
+
url = helper.createLink(doclet, dependencies);
|
|
123
81
|
url = url.replace(/(#.+|$)/, hash);
|
|
124
82
|
|
|
125
|
-
return
|
|
83
|
+
return `<a href="${url}">${hash}</a>`;
|
|
126
84
|
}
|
|
127
85
|
|
|
128
|
-
function needsSignature(
|
|
129
|
-
|
|
86
|
+
function needsSignature({ kind, type, meta }) {
|
|
87
|
+
let needsSig = false;
|
|
130
88
|
|
|
131
89
|
// function and class definitions always get a signature
|
|
132
|
-
if (
|
|
90
|
+
if (kind === 'function' || kind === 'class') {
|
|
133
91
|
needsSig = true;
|
|
134
92
|
}
|
|
93
|
+
|
|
135
94
|
// typedefs that contain functions get a signature, too
|
|
136
|
-
else if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
doclet.type.names &&
|
|
140
|
-
doclet.type.names.length
|
|
141
|
-
) {
|
|
142
|
-
for (var i = 0, l = doclet.type.names.length; i < l; i++) {
|
|
143
|
-
if (doclet.type.names[i].toLowerCase() === 'function') {
|
|
95
|
+
else if (kind === 'typedef' && type && type.names && type.names.length) {
|
|
96
|
+
for (var i = 0, l = type.names.length; i < l; i++) {
|
|
97
|
+
if (type.names[i].toLowerCase() === 'function') {
|
|
144
98
|
needsSig = true;
|
|
145
99
|
break;
|
|
146
100
|
}
|
|
147
101
|
}
|
|
148
102
|
}
|
|
149
103
|
|
|
104
|
+
// and namespaces that are functions get a signature (but finding them is a
|
|
105
|
+
// bit messy)
|
|
106
|
+
else if (
|
|
107
|
+
kind === 'namespace' &&
|
|
108
|
+
meta &&
|
|
109
|
+
meta.code &&
|
|
110
|
+
meta.code.type &&
|
|
111
|
+
meta.code.type.match(/[Ff]unction/)
|
|
112
|
+
) {
|
|
113
|
+
needsSig = true;
|
|
114
|
+
}
|
|
115
|
+
|
|
150
116
|
return needsSig;
|
|
151
117
|
}
|
|
152
118
|
|
|
153
|
-
function getSignatureAttributes(
|
|
154
|
-
|
|
119
|
+
function getSignatureAttributes({ optional, nullable }) {
|
|
120
|
+
const attributes = [];
|
|
155
121
|
|
|
156
|
-
if (
|
|
122
|
+
if (optional) {
|
|
157
123
|
attributes.push('opt');
|
|
158
124
|
}
|
|
159
125
|
|
|
160
|
-
if (
|
|
126
|
+
if (nullable === true) {
|
|
161
127
|
attributes.push('nullable');
|
|
162
|
-
} else if (
|
|
128
|
+
} else if (nullable === false) {
|
|
163
129
|
attributes.push('non-null');
|
|
164
130
|
}
|
|
165
131
|
|
|
@@ -167,19 +133,17 @@ function getSignatureAttributes(item) {
|
|
|
167
133
|
}
|
|
168
134
|
|
|
169
135
|
function updateItemName(item) {
|
|
170
|
-
|
|
171
|
-
|
|
136
|
+
const attributes = getSignatureAttributes(item);
|
|
137
|
+
let itemName = item.name || '';
|
|
172
138
|
|
|
173
139
|
if (item.variable) {
|
|
174
140
|
itemName = '…' + itemName;
|
|
175
141
|
}
|
|
176
142
|
|
|
177
143
|
if (attributes && attributes.length) {
|
|
178
|
-
itemName =
|
|
179
|
-
'
|
|
180
|
-
|
|
181
|
-
attributes.join(', ')
|
|
182
|
-
);
|
|
144
|
+
itemName = `${itemName}<span class="signature-attributes">${attributes.join(
|
|
145
|
+
', '
|
|
146
|
+
)}</span>`;
|
|
183
147
|
}
|
|
184
148
|
|
|
185
149
|
return itemName;
|
|
@@ -187,14 +151,12 @@ function updateItemName(item) {
|
|
|
187
151
|
|
|
188
152
|
function addParamAttributes(params) {
|
|
189
153
|
return params
|
|
190
|
-
.filter(
|
|
191
|
-
return param.name && param.name.indexOf('.') === -1;
|
|
192
|
-
})
|
|
154
|
+
.filter(({ name }) => name && !name.includes('.'))
|
|
193
155
|
.map(updateItemName);
|
|
194
156
|
}
|
|
195
157
|
|
|
196
158
|
function buildItemTypeStrings(item) {
|
|
197
|
-
|
|
159
|
+
const types = [];
|
|
198
160
|
|
|
199
161
|
if (item && item.type && item.type.names) {
|
|
200
162
|
item.type.names.forEach(function (name) {
|
|
@@ -206,17 +168,17 @@ function buildItemTypeStrings(item) {
|
|
|
206
168
|
}
|
|
207
169
|
|
|
208
170
|
function buildAttribsString(attribs) {
|
|
209
|
-
|
|
171
|
+
let attribsString = '';
|
|
210
172
|
|
|
211
173
|
if (attribs && attribs.length) {
|
|
212
|
-
|
|
174
|
+
htmlsafe(`(${attribs.join(', ')}) `);
|
|
213
175
|
}
|
|
214
176
|
|
|
215
177
|
return attribsString;
|
|
216
178
|
}
|
|
217
179
|
|
|
218
180
|
function addNonParamAttributes(items) {
|
|
219
|
-
|
|
181
|
+
let types = [];
|
|
220
182
|
|
|
221
183
|
items.forEach(function (item) {
|
|
222
184
|
types = types.concat(buildItemTypeStrings(item));
|
|
@@ -226,24 +188,25 @@ function addNonParamAttributes(items) {
|
|
|
226
188
|
}
|
|
227
189
|
|
|
228
190
|
function addSignatureParams(f) {
|
|
229
|
-
|
|
191
|
+
const params = f.params ? addParamAttributes(f.params) : [];
|
|
230
192
|
|
|
231
|
-
f.signature =
|
|
193
|
+
f.signature = `${f.signature || ''}(${params.join(', ')})`;
|
|
232
194
|
}
|
|
233
195
|
|
|
234
196
|
function addSignatureReturns(f) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
197
|
+
const attribs = [];
|
|
198
|
+
let attribsString = '';
|
|
199
|
+
let returnTypes = [];
|
|
200
|
+
let returnTypesString = '';
|
|
201
|
+
const source = f.yields || f.returns;
|
|
239
202
|
|
|
240
203
|
// jam all the return-type attributes into an array. this could create odd results (for example,
|
|
241
204
|
// if there are both nullable and non-nullable return types), but let's assume that most people
|
|
242
205
|
// who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
helper.getAttribs(item).forEach(
|
|
246
|
-
if (attribs.
|
|
206
|
+
if (source) {
|
|
207
|
+
source.forEach((item) => {
|
|
208
|
+
helper.getAttribs(item).forEach((attrib) => {
|
|
209
|
+
if (!attribs.includes(attrib)) {
|
|
247
210
|
attribs.push(attrib);
|
|
248
211
|
}
|
|
249
212
|
});
|
|
@@ -252,51 +215,42 @@ function addSignatureReturns(f) {
|
|
|
252
215
|
attribsString = buildAttribsString(attribs);
|
|
253
216
|
}
|
|
254
217
|
|
|
255
|
-
if (
|
|
256
|
-
returnTypes = addNonParamAttributes(
|
|
218
|
+
if (source) {
|
|
219
|
+
returnTypes = addNonParamAttributes(source);
|
|
257
220
|
}
|
|
258
221
|
if (returnTypes.length) {
|
|
259
|
-
returnTypesString =
|
|
260
|
-
'
|
|
261
|
-
|
|
262
|
-
returnTypes.join('|')
|
|
263
|
-
);
|
|
222
|
+
returnTypesString = ` → ${attribsString}{${returnTypes.join(
|
|
223
|
+
'|'
|
|
224
|
+
)}}`;
|
|
264
225
|
}
|
|
265
226
|
|
|
266
|
-
var signatureOutput =
|
|
227
|
+
var signatureOutput = '';
|
|
267
228
|
|
|
268
229
|
if (f.signature) {
|
|
269
|
-
signatureOutput =
|
|
270
|
-
(f.signature || '') +
|
|
271
|
-
'</span>'
|
|
230
|
+
signatureOutput =
|
|
231
|
+
'<span class="signature">' + (f.signature || '') + '</span>';
|
|
272
232
|
}
|
|
273
233
|
if (returnTypesString) {
|
|
274
|
-
signatureOutput +=
|
|
275
|
-
returnTypesString +
|
|
276
|
-
'</span>'
|
|
234
|
+
signatureOutput +=
|
|
235
|
+
'<span class="type-signature">' + returnTypesString + '</span>';
|
|
277
236
|
}
|
|
278
237
|
|
|
279
|
-
f.signature = signatureOutput
|
|
238
|
+
f.signature = signatureOutput;
|
|
280
239
|
}
|
|
281
240
|
|
|
282
241
|
function addSignatureTypes(f) {
|
|
283
|
-
|
|
242
|
+
const types = f.type ? buildItemTypeStrings(f) : [];
|
|
284
243
|
|
|
285
244
|
f.signature =
|
|
286
|
-
|
|
287
|
-
'
|
|
288
|
-
(types.length ? ' :' + types.join('|') : '') +
|
|
289
|
-
'</span>';
|
|
245
|
+
`${f.signature || ''}<span class="type-signature">` +
|
|
246
|
+
`${types.length ? ` :${types.join('|')}` : ''}</span>`;
|
|
290
247
|
}
|
|
291
248
|
|
|
292
249
|
function addAttribs(f) {
|
|
293
|
-
|
|
294
|
-
|
|
250
|
+
const attribs = helper.getAttribs(f);
|
|
251
|
+
const attribsString = buildAttribsString(attribs);
|
|
295
252
|
|
|
296
|
-
f.attribs =
|
|
297
|
-
'<span class="type-signature">%s</span>',
|
|
298
|
-
attribsString
|
|
299
|
-
);
|
|
253
|
+
f.attribs = `<span class="type-signature">${attribsString}</span>`;
|
|
300
254
|
}
|
|
301
255
|
|
|
302
256
|
function shortenPaths(files, commonPrefix) {
|
|
@@ -310,29 +264,31 @@ function shortenPaths(files, commonPrefix) {
|
|
|
310
264
|
return files;
|
|
311
265
|
}
|
|
312
266
|
|
|
313
|
-
function getPathFromDoclet(
|
|
314
|
-
if (!
|
|
267
|
+
function getPathFromDoclet({ meta }) {
|
|
268
|
+
if (!meta) {
|
|
315
269
|
return null;
|
|
316
270
|
}
|
|
317
271
|
|
|
318
|
-
return
|
|
319
|
-
? path.join(
|
|
320
|
-
:
|
|
272
|
+
return meta.path && meta.path !== 'null'
|
|
273
|
+
? path.join(meta.path, meta.filename)
|
|
274
|
+
: meta.filename;
|
|
321
275
|
}
|
|
322
276
|
|
|
323
|
-
function generate(
|
|
324
|
-
|
|
277
|
+
function generate(title, docs, filename, resolveLinks) {
|
|
278
|
+
let docData;
|
|
279
|
+
let html;
|
|
280
|
+
let outpath;
|
|
325
281
|
|
|
326
|
-
|
|
327
|
-
|
|
282
|
+
docData = {
|
|
283
|
+
env: env,
|
|
328
284
|
title: title,
|
|
329
|
-
docs: docs
|
|
285
|
+
docs: docs,
|
|
330
286
|
};
|
|
331
287
|
|
|
332
|
-
|
|
333
|
-
|
|
288
|
+
outpath = path.join(outdir, filename);
|
|
289
|
+
html = view.render('container.tmpl', docData);
|
|
334
290
|
|
|
335
|
-
if (resolveLinks) {
|
|
291
|
+
if (resolveLinks !== false) {
|
|
336
292
|
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
|
337
293
|
}
|
|
338
294
|
|
|
@@ -343,24 +299,23 @@ function generate(type, title, docs, filename, resolveLinks) {
|
|
|
343
299
|
);
|
|
344
300
|
}
|
|
345
301
|
|
|
346
|
-
function generateSourceFiles(sourceFiles, encoding) {
|
|
347
|
-
encoding = encoding || 'utf8';
|
|
302
|
+
function generateSourceFiles(sourceFiles, encoding = 'utf8') {
|
|
348
303
|
Object.keys(sourceFiles).forEach(function (file) {
|
|
349
|
-
|
|
304
|
+
let source;
|
|
350
305
|
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
|
|
351
|
-
|
|
306
|
+
const sourceOutFile = helper.getUniqueFilename(
|
|
352
307
|
sourceFiles[file].shortened
|
|
353
308
|
);
|
|
354
309
|
|
|
355
|
-
helper.registerLink(sourceFiles[file].shortened,
|
|
310
|
+
helper.registerLink(sourceFiles[file].shortened, sourceOutFile);
|
|
356
311
|
|
|
357
312
|
try {
|
|
358
313
|
source = {
|
|
359
314
|
kind: 'source',
|
|
360
|
-
title:
|
|
315
|
+
title: sourceOutFile.replace('.html', ''),
|
|
361
316
|
code: helper.htmlsafe(
|
|
362
317
|
fs.readFileSync(sourceFiles[file].resolved, encoding)
|
|
363
|
-
)
|
|
318
|
+
),
|
|
364
319
|
};
|
|
365
320
|
} catch (e) {
|
|
366
321
|
logger.error(
|
|
@@ -371,10 +326,9 @@ function generateSourceFiles(sourceFiles, encoding) {
|
|
|
371
326
|
}
|
|
372
327
|
|
|
373
328
|
generate(
|
|
374
|
-
|
|
375
|
-
sourceFiles[file].shortened,
|
|
329
|
+
`Source: ${sourceFiles[file].shortened}`,
|
|
376
330
|
[source],
|
|
377
|
-
|
|
331
|
+
sourceOutFile,
|
|
378
332
|
false
|
|
379
333
|
);
|
|
380
334
|
});
|
|
@@ -392,30 +346,30 @@ function generateSourceFiles(sourceFiles, encoding) {
|
|
|
392
346
|
* @param {Array.<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.
|
|
393
347
|
*/
|
|
394
348
|
function attachModuleSymbols(doclets, modules) {
|
|
395
|
-
|
|
349
|
+
const symbols = {};
|
|
396
350
|
|
|
397
351
|
// build a lookup table
|
|
398
|
-
doclets.forEach(
|
|
352
|
+
doclets.forEach((symbol) => {
|
|
399
353
|
symbols[symbol.longname] = symbols[symbol.longname] || [];
|
|
400
354
|
symbols[symbol.longname].push(symbol);
|
|
401
355
|
});
|
|
402
356
|
|
|
403
|
-
|
|
404
|
-
return modules.map(function (module) {
|
|
357
|
+
modules.forEach((module) => {
|
|
405
358
|
if (symbols[module.longname]) {
|
|
406
359
|
module.modules = symbols[module.longname]
|
|
407
360
|
// Only show symbols that have a description. Make an exception for classes, because
|
|
408
361
|
// we want to show the constructor-signature heading no matter what.
|
|
409
|
-
.filter(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
.map(
|
|
413
|
-
symbol =
|
|
362
|
+
.filter(
|
|
363
|
+
({ description, kind }) => description || kind === 'class'
|
|
364
|
+
)
|
|
365
|
+
.map((symbol) => {
|
|
366
|
+
symbol = _.cloneDeep(symbol);
|
|
414
367
|
|
|
415
368
|
if (symbol.kind === 'class' || symbol.kind === 'function') {
|
|
416
|
-
symbol.name =
|
|
417
|
-
|
|
418
|
-
'"
|
|
369
|
+
symbol.name = `${symbol.name.replace(
|
|
370
|
+
'module:',
|
|
371
|
+
'(require("'
|
|
372
|
+
)}"))`;
|
|
419
373
|
}
|
|
420
374
|
|
|
421
375
|
return symbol;
|
|
@@ -424,103 +378,17 @@ function attachModuleSymbols(doclets, modules) {
|
|
|
424
378
|
});
|
|
425
379
|
}
|
|
426
380
|
|
|
427
|
-
function buildFooter() {
|
|
428
|
-
var footer = themeOpts.footer;
|
|
429
|
-
|
|
430
|
-
return footer;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function getFavicon() {
|
|
434
|
-
var favicon = themeOpts.favicon || undefined;
|
|
435
|
-
|
|
436
|
-
return favicon;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// function copy
|
|
440
|
-
function createDynamicStyleSheet() {
|
|
441
|
-
var styleClass = themeOpts.create_style || undefined;
|
|
442
|
-
/* prettier-ignore-start */
|
|
443
|
-
|
|
444
|
-
return styleClass;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
function createDynamicsScripts() {
|
|
448
|
-
var scripts = themeOpts.add_scripts || undefined;
|
|
449
|
-
|
|
450
|
-
return scripts;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function returnPathOfScriptScr() {
|
|
454
|
-
var scriptPath = themeOpts.add_script_path || undefined;
|
|
455
|
-
|
|
456
|
-
return scriptPath;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function returnPathOfStyleSrc() {
|
|
460
|
-
var stylePath = themeOpts.add_style_path || undefined;
|
|
461
|
-
|
|
462
|
-
return stylePath;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function includeCss() {
|
|
466
|
-
var stylePath = themeOpts.include_css || undefined;
|
|
467
|
-
|
|
468
|
-
if (stylePath) {
|
|
469
|
-
stylePath = copyToOutputFolderFromArray(stylePath);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
return stylePath;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
function resizeable() {
|
|
476
|
-
var resizeOpts = themeOpts.resizeable || {};
|
|
477
|
-
|
|
478
|
-
return resizeOpts;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
function codepen() {
|
|
482
|
-
var codepenOpts = themeOpts.codepen || {};
|
|
483
|
-
|
|
484
|
-
return codepenOpts;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function includeScript() {
|
|
488
|
-
var scriptPath = themeOpts.include_js || undefined;
|
|
489
|
-
|
|
490
|
-
if (scriptPath) {
|
|
491
|
-
scriptPath = copyToOutputFolderFromArray(scriptPath);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
return scriptPath;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
function getMetaTagData() {
|
|
498
|
-
var meta = themeOpts.meta || undefined;
|
|
499
|
-
|
|
500
|
-
return meta;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function getTheme() {
|
|
504
|
-
var theme = themeOpts.default_theme || 'dark';
|
|
505
|
-
|
|
506
|
-
return theme;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function getBaseURL() {
|
|
510
|
-
return themeOpts.base_url;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
381
|
function buildSidebarMembers({
|
|
514
382
|
items,
|
|
515
383
|
itemHeading,
|
|
516
384
|
itemsSeen,
|
|
517
385
|
linktoFn,
|
|
518
|
-
sectionName
|
|
386
|
+
sectionName,
|
|
519
387
|
}) {
|
|
520
388
|
const navProps = {
|
|
521
389
|
name: itemHeading,
|
|
522
390
|
items: [],
|
|
523
|
-
id: nanoid()
|
|
391
|
+
id: nanoid(),
|
|
524
392
|
};
|
|
525
393
|
|
|
526
394
|
if (items.length) {
|
|
@@ -530,7 +398,7 @@ function buildSidebarMembers({
|
|
|
530
398
|
anchor: item.longname
|
|
531
399
|
? linktoFn(item.longname, item.name)
|
|
532
400
|
: linktoFn('', item.name),
|
|
533
|
-
children: []
|
|
401
|
+
children: [],
|
|
534
402
|
};
|
|
535
403
|
|
|
536
404
|
var methods =
|
|
@@ -541,8 +409,8 @@ function buildSidebarMembers({
|
|
|
541
409
|
kind: 'function',
|
|
542
410
|
memberof: item.longname,
|
|
543
411
|
inherited: {
|
|
544
|
-
'!is': Boolean(themeOpts.exclude_inherited)
|
|
545
|
-
}
|
|
412
|
+
'!is': Boolean(themeOpts.exclude_inherited),
|
|
413
|
+
},
|
|
546
414
|
});
|
|
547
415
|
|
|
548
416
|
if (!hasOwnProp.call(itemsSeen, item.longname)) {
|
|
@@ -555,7 +423,7 @@ function buildSidebarMembers({
|
|
|
555
423
|
searchListArray.push({
|
|
556
424
|
title: item.name,
|
|
557
425
|
link: linktoFn(item.longname, item.name),
|
|
558
|
-
description: item.description
|
|
426
|
+
description: item.description,
|
|
559
427
|
});
|
|
560
428
|
}
|
|
561
429
|
|
|
@@ -563,7 +431,7 @@ function buildSidebarMembers({
|
|
|
563
431
|
methods.forEach(function (method) {
|
|
564
432
|
const itemChild = {
|
|
565
433
|
name: method.longName,
|
|
566
|
-
link: linktoFn(method.longname, method.name)
|
|
434
|
+
link: linktoFn(method.longname, method.name),
|
|
567
435
|
};
|
|
568
436
|
|
|
569
437
|
currentItem.children.push(itemChild);
|
|
@@ -580,7 +448,7 @@ function buildSidebarMembers({
|
|
|
580
448
|
searchListArray.push({
|
|
581
449
|
title: method.longname,
|
|
582
450
|
link: linktoFn(method.longname, name),
|
|
583
|
-
description: item.classdesc
|
|
451
|
+
description: item.classdesc,
|
|
584
452
|
});
|
|
585
453
|
}
|
|
586
454
|
});
|
|
@@ -603,15 +471,24 @@ function linktoExternal(longName, name) {
|
|
|
603
471
|
return linkto(longName, name.replace(/(^"|"$)/g, ''));
|
|
604
472
|
}
|
|
605
473
|
|
|
474
|
+
/**
|
|
475
|
+
* This function is added by clean-jsdoc-theme devs
|
|
476
|
+
* This function is added by clean-jsdoc-theme devs
|
|
477
|
+
* This function is added by clean-jsdoc-theme devs
|
|
478
|
+
*
|
|
479
|
+
*/
|
|
606
480
|
function buildNavbar() {
|
|
607
481
|
return {
|
|
608
482
|
menu: themeOpts.menu || undefined,
|
|
609
|
-
search: hasSearch
|
|
483
|
+
search: hasSearch,
|
|
610
484
|
};
|
|
611
485
|
}
|
|
612
486
|
|
|
613
487
|
/**
|
|
614
|
-
*
|
|
488
|
+
* This function is added by clean-jsdoc-theme devs
|
|
489
|
+
* This function is added by clean-jsdoc-theme devs
|
|
490
|
+
* This function is added by clean-jsdoc-theme devs
|
|
491
|
+
*
|
|
615
492
|
* @param {object} members The members that will be used to create the sidebar.
|
|
616
493
|
* @param {array<object>} members.classes
|
|
617
494
|
* @param {array<object>} members.externals
|
|
@@ -630,18 +507,18 @@ function buildSidebar(members) {
|
|
|
630
507
|
var isHTML = RegExp.prototype.test.bind(/(<([^>]+)>)/i);
|
|
631
508
|
|
|
632
509
|
var nav = {
|
|
633
|
-
sections: []
|
|
510
|
+
sections: [],
|
|
634
511
|
};
|
|
635
512
|
|
|
636
513
|
if (!isHTML(title)) {
|
|
637
514
|
nav.title = {
|
|
638
515
|
title,
|
|
639
|
-
isHTML: false
|
|
516
|
+
isHTML: false,
|
|
640
517
|
};
|
|
641
518
|
} else {
|
|
642
519
|
nav.title = {
|
|
643
520
|
title,
|
|
644
|
-
isHTML: true
|
|
521
|
+
isHTML: true,
|
|
645
522
|
};
|
|
646
523
|
}
|
|
647
524
|
|
|
@@ -657,7 +534,7 @@ function buildSidebar(members) {
|
|
|
657
534
|
items: members.modules,
|
|
658
535
|
itemsSeen: seen,
|
|
659
536
|
linktoFn: linkto,
|
|
660
|
-
sectionName: SECTION_TYPE.Modules
|
|
537
|
+
sectionName: SECTION_TYPE.Modules,
|
|
661
538
|
}),
|
|
662
539
|
|
|
663
540
|
[SECTION_TYPE.Classes]: buildSidebarMembers({
|
|
@@ -665,7 +542,7 @@ function buildSidebar(members) {
|
|
|
665
542
|
items: members.classes,
|
|
666
543
|
itemsSeen: seen,
|
|
667
544
|
linktoFn: linkto,
|
|
668
|
-
sectionName: SECTION_TYPE.Classes
|
|
545
|
+
sectionName: SECTION_TYPE.Classes,
|
|
669
546
|
}),
|
|
670
547
|
|
|
671
548
|
[SECTION_TYPE.Externals]: buildSidebarMembers({
|
|
@@ -673,7 +550,7 @@ function buildSidebar(members) {
|
|
|
673
550
|
items: members.externals,
|
|
674
551
|
itemsSeen: seen,
|
|
675
552
|
linktoFn: linktoExternal,
|
|
676
|
-
sectionName: SECTION_TYPE.Externals
|
|
553
|
+
sectionName: SECTION_TYPE.Externals,
|
|
677
554
|
}),
|
|
678
555
|
|
|
679
556
|
[SECTION_TYPE.Events]: buildSidebarMembers({
|
|
@@ -681,7 +558,7 @@ function buildSidebar(members) {
|
|
|
681
558
|
items: members.events,
|
|
682
559
|
itemsSeen: seen,
|
|
683
560
|
linktoFn: linkto,
|
|
684
|
-
sectionName: SECTION_TYPE.Events
|
|
561
|
+
sectionName: SECTION_TYPE.Events,
|
|
685
562
|
}),
|
|
686
563
|
|
|
687
564
|
[SECTION_TYPE.Namespaces]: buildSidebarMembers({
|
|
@@ -689,7 +566,7 @@ function buildSidebar(members) {
|
|
|
689
566
|
items: members.namespaces,
|
|
690
567
|
itemsSeen: seen,
|
|
691
568
|
linktoFn: linkto,
|
|
692
|
-
sectionName: SECTION_TYPE.Namespaces
|
|
569
|
+
sectionName: SECTION_TYPE.Namespaces,
|
|
693
570
|
}),
|
|
694
571
|
|
|
695
572
|
[SECTION_TYPE.Mixins]: buildSidebarMembers({
|
|
@@ -697,7 +574,7 @@ function buildSidebar(members) {
|
|
|
697
574
|
items: members.mixins,
|
|
698
575
|
itemsSeen: seen,
|
|
699
576
|
linktoFn: linkto,
|
|
700
|
-
sectionName: SECTION_TYPE.Mixins
|
|
577
|
+
sectionName: SECTION_TYPE.Mixins,
|
|
701
578
|
}),
|
|
702
579
|
|
|
703
580
|
[SECTION_TYPE.Tutorials]: buildSidebarMembers({
|
|
@@ -705,7 +582,7 @@ function buildSidebar(members) {
|
|
|
705
582
|
items: members.tutorials,
|
|
706
583
|
itemsSeen: seenTutorials,
|
|
707
584
|
linktoFn: linktoTutorial,
|
|
708
|
-
sectionName: SECTION_TYPE.Tutorials
|
|
585
|
+
sectionName: SECTION_TYPE.Tutorials,
|
|
709
586
|
}),
|
|
710
587
|
|
|
711
588
|
[SECTION_TYPE.Interfaces]: buildSidebarMembers({
|
|
@@ -713,7 +590,7 @@ function buildSidebar(members) {
|
|
|
713
590
|
items: members.interfaces,
|
|
714
591
|
itemsSeen: seen,
|
|
715
592
|
linktoFn: linkto,
|
|
716
|
-
sectionName: SECTION_TYPE.Interfaces
|
|
593
|
+
sectionName: SECTION_TYPE.Interfaces,
|
|
717
594
|
}),
|
|
718
595
|
|
|
719
596
|
[SECTION_TYPE.Global]: buildSidebarMembers({
|
|
@@ -721,8 +598,8 @@ function buildSidebar(members) {
|
|
|
721
598
|
items: members.globals,
|
|
722
599
|
itemsSeen: seenGlobal,
|
|
723
600
|
linktoFn: linkto,
|
|
724
|
-
sectionName: SECTION_TYPE.Global
|
|
725
|
-
})
|
|
601
|
+
sectionName: SECTION_TYPE.Global,
|
|
602
|
+
}),
|
|
726
603
|
};
|
|
727
604
|
|
|
728
605
|
sectionsOrder.forEach((section) => {
|
|
@@ -740,39 +617,54 @@ function buildSidebar(members) {
|
|
|
740
617
|
return nav;
|
|
741
618
|
}
|
|
742
619
|
|
|
743
|
-
|
|
744
620
|
/**
|
|
745
621
|
@param {TAFFY} taffyData See <http://taffydb.com/>.
|
|
746
622
|
@param {object} opts
|
|
747
623
|
@param {Tutorial} tutorials
|
|
748
624
|
*/
|
|
749
625
|
exports.publish = function (taffyData, opts, tutorials) {
|
|
750
|
-
|
|
626
|
+
let classes;
|
|
627
|
+
let conf;
|
|
628
|
+
let externals;
|
|
629
|
+
let files;
|
|
630
|
+
let fromDir;
|
|
631
|
+
let globalUrl;
|
|
632
|
+
let indexUrl;
|
|
633
|
+
let interfaces;
|
|
634
|
+
let members;
|
|
635
|
+
let mixins;
|
|
636
|
+
let modules;
|
|
637
|
+
let namespaces;
|
|
638
|
+
let outputSourceFiles;
|
|
639
|
+
let packageInfo;
|
|
640
|
+
let packages;
|
|
641
|
+
const sourceFilePaths = [];
|
|
642
|
+
let sourceFiles = {};
|
|
643
|
+
let staticFileFilter;
|
|
644
|
+
let staticFilePaths;
|
|
645
|
+
let staticFiles;
|
|
646
|
+
let staticFileScanner;
|
|
647
|
+
let templatePath;
|
|
751
648
|
|
|
752
|
-
|
|
753
|
-
var conf = env.conf.templates || {};
|
|
649
|
+
data = taffyData;
|
|
754
650
|
|
|
651
|
+
conf = env.conf.templates || {};
|
|
755
652
|
conf.default = conf.default || {};
|
|
756
653
|
|
|
757
|
-
|
|
758
|
-
|
|
654
|
+
templatePath = path.normalize(opts.template);
|
|
759
655
|
view = new template.Template(path.join(templatePath, 'tmpl'));
|
|
760
656
|
|
|
761
657
|
// claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness
|
|
762
658
|
// doesn't try to hand them out later
|
|
763
|
-
|
|
659
|
+
indexUrl = helper.getUniqueFilename('index');
|
|
764
660
|
// don't call registerLink() on this one! 'index' is also a valid longname
|
|
765
661
|
|
|
766
|
-
|
|
767
|
-
|
|
662
|
+
globalUrl = helper.getUniqueFilename('global');
|
|
768
663
|
helper.registerLink('global', globalUrl);
|
|
769
664
|
|
|
770
665
|
// set up templating
|
|
771
666
|
view.layout = conf.default.layoutFile
|
|
772
|
-
? path.
|
|
773
|
-
path.dirname(conf.default.layoutFile),
|
|
774
|
-
path.basename(conf.default.layoutFile)
|
|
775
|
-
)
|
|
667
|
+
? path.resolve(conf.default.layoutFile)
|
|
776
668
|
: 'layout.tmpl';
|
|
777
669
|
|
|
778
670
|
// set up tutorials for helper
|
|
@@ -782,22 +674,15 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
782
674
|
data.sort('longname, version, since');
|
|
783
675
|
helper.addEventListeners(data);
|
|
784
676
|
|
|
785
|
-
|
|
786
|
-
|
|
677
|
+
data().each((doclet) => {
|
|
678
|
+
let sourcePath;
|
|
787
679
|
|
|
788
|
-
data().each(function (doclet) {
|
|
789
680
|
doclet.attribs = '';
|
|
790
681
|
|
|
791
682
|
if (doclet.examples) {
|
|
792
|
-
doclet.examples = doclet.examples.map(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
if (example === undefined) {
|
|
796
|
-
return {
|
|
797
|
-
caption: '',
|
|
798
|
-
code: ''
|
|
799
|
-
};
|
|
800
|
-
}
|
|
683
|
+
doclet.examples = doclet.examples.map((example) => {
|
|
684
|
+
let caption;
|
|
685
|
+
let code;
|
|
801
686
|
|
|
802
687
|
if (
|
|
803
688
|
example.match(
|
|
@@ -810,7 +695,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
810
695
|
|
|
811
696
|
return {
|
|
812
697
|
caption: caption || '',
|
|
813
|
-
code: code || example
|
|
698
|
+
code: code || example,
|
|
814
699
|
};
|
|
815
700
|
});
|
|
816
701
|
}
|
|
@@ -821,44 +706,43 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
821
706
|
}
|
|
822
707
|
|
|
823
708
|
// build a list of source files
|
|
824
|
-
var sourcePath;
|
|
825
|
-
|
|
826
709
|
if (doclet.meta) {
|
|
827
710
|
sourcePath = getPathFromDoclet(doclet);
|
|
828
711
|
sourceFiles[sourcePath] = {
|
|
829
712
|
resolved: sourcePath,
|
|
830
|
-
shortened: null
|
|
713
|
+
shortened: null,
|
|
831
714
|
};
|
|
832
715
|
if (sourceFilePaths.indexOf(sourcePath) === -1) {
|
|
833
716
|
sourceFilePaths.push(sourcePath);
|
|
834
717
|
}
|
|
835
718
|
}
|
|
719
|
+
|
|
720
|
+
// added by clean-jsdoc-theme-dev.
|
|
721
|
+
// to process yields.
|
|
722
|
+
if (doclet.yields) {
|
|
723
|
+
doclet.yields = getProcessedYield(doclet.yields);
|
|
724
|
+
}
|
|
836
725
|
});
|
|
837
726
|
|
|
838
727
|
// update outdir if necessary, then create outdir
|
|
839
|
-
|
|
840
|
-
|
|
728
|
+
packageInfo = (find({ kind: 'package' }) || [])[0];
|
|
841
729
|
if (packageInfo && packageInfo.name) {
|
|
842
730
|
outdir = path.join(outdir, packageInfo.name, packageInfo.version || '');
|
|
843
731
|
}
|
|
844
732
|
fs.mkPath(outdir);
|
|
845
733
|
|
|
846
734
|
// copy the template's static files to outdir
|
|
847
|
-
|
|
848
|
-
|
|
735
|
+
fromDir = path.join(templatePath, 'static');
|
|
736
|
+
staticFiles = fs.ls(fromDir, 3);
|
|
849
737
|
|
|
850
|
-
staticFiles.forEach(
|
|
851
|
-
|
|
738
|
+
staticFiles.forEach((fileName) => {
|
|
739
|
+
const toDir = fs.toDir(fileName.replace(fromDir, outdir));
|
|
852
740
|
|
|
853
741
|
fs.mkPath(toDir);
|
|
854
742
|
fs.copyFileSync(fileName, toDir);
|
|
855
743
|
});
|
|
856
744
|
|
|
857
745
|
// copy user-specified static files to outdir
|
|
858
|
-
var staticFilePaths;
|
|
859
|
-
var staticFileFilter;
|
|
860
|
-
var staticFileScanner;
|
|
861
|
-
|
|
862
746
|
if (conf.default.staticFiles) {
|
|
863
747
|
// The canonical property name is `include`. We accept `paths` for backwards compatibility
|
|
864
748
|
// with a bug in JSDoc 3.2.x.
|
|
@@ -871,16 +755,17 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
871
755
|
);
|
|
872
756
|
staticFileScanner = new (require('jsdoc/src/scanner').Scanner)();
|
|
873
757
|
|
|
874
|
-
staticFilePaths.forEach(
|
|
875
|
-
|
|
758
|
+
staticFilePaths.forEach((filePath) => {
|
|
759
|
+
filePath = path.resolve(env.pwd, filePath);
|
|
760
|
+
const extraStaticFiles = staticFileScanner.scan(
|
|
876
761
|
[filePath],
|
|
877
762
|
10,
|
|
878
763
|
staticFileFilter
|
|
879
764
|
);
|
|
880
765
|
|
|
881
|
-
extraStaticFiles.forEach(
|
|
882
|
-
|
|
883
|
-
|
|
766
|
+
extraStaticFiles.forEach((fileName) => {
|
|
767
|
+
const sourcePath = fs.toDir(filePath);
|
|
768
|
+
const toDir = fs.toDir(fileName.replace(sourcePath, outdir));
|
|
884
769
|
|
|
885
770
|
fs.mkPath(toDir);
|
|
886
771
|
fs.copyFileSync(fileName, toDir);
|
|
@@ -891,17 +776,17 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
891
776
|
if (sourceFilePaths.length) {
|
|
892
777
|
sourceFiles = shortenPaths(
|
|
893
778
|
sourceFiles,
|
|
894
|
-
|
|
779
|
+
commonPathPrefix(sourceFilePaths)
|
|
895
780
|
);
|
|
896
781
|
}
|
|
782
|
+
|
|
897
783
|
data().each(function (doclet) {
|
|
898
|
-
|
|
784
|
+
let docletPath;
|
|
785
|
+
const url = helper.createLink(doclet);
|
|
899
786
|
|
|
900
787
|
helper.registerLink(doclet.longname, url);
|
|
901
788
|
|
|
902
789
|
// add a shortened version of the full path
|
|
903
|
-
var docletPath;
|
|
904
|
-
|
|
905
790
|
if (doclet.meta) {
|
|
906
791
|
docletPath = getPathFromDoclet(doclet);
|
|
907
792
|
docletPath = sourceFiles[docletPath].shortened;
|
|
@@ -912,7 +797,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
912
797
|
});
|
|
913
798
|
|
|
914
799
|
data().each(function (doclet) {
|
|
915
|
-
|
|
800
|
+
const url = helper.longnameToUrl[doclet.longname];
|
|
916
801
|
|
|
917
802
|
if (url.indexOf('#') > -1) {
|
|
918
803
|
doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
|
|
@@ -928,7 +813,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
928
813
|
});
|
|
929
814
|
|
|
930
815
|
// do this after the urls have all been generated
|
|
931
|
-
data().each(
|
|
816
|
+
data().each((doclet) => {
|
|
932
817
|
doclet.ancestors = getAncestorLinks(doclet);
|
|
933
818
|
|
|
934
819
|
if (doclet.kind === 'member') {
|
|
@@ -943,12 +828,11 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
943
828
|
}
|
|
944
829
|
});
|
|
945
830
|
|
|
946
|
-
|
|
947
|
-
|
|
831
|
+
members = helper.getMembers(data);
|
|
948
832
|
members.tutorials = tutorials.children;
|
|
949
833
|
|
|
950
834
|
// output pretty-printed source files by default
|
|
951
|
-
|
|
835
|
+
outputSourceFiles = Boolean(
|
|
952
836
|
conf.default && conf.default.outputSourceFiles !== false
|
|
953
837
|
);
|
|
954
838
|
|
|
@@ -959,36 +843,37 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
959
843
|
view.tutoriallink = tutoriallink;
|
|
960
844
|
view.htmlsafe = htmlsafe;
|
|
961
845
|
view.outputSourceFiles = outputSourceFiles;
|
|
962
|
-
view.footer = buildFooter();
|
|
963
|
-
view.
|
|
964
|
-
view.
|
|
965
|
-
view.
|
|
966
|
-
view.
|
|
967
|
-
view.
|
|
968
|
-
view.
|
|
969
|
-
view.
|
|
970
|
-
view.
|
|
971
|
-
view.
|
|
846
|
+
view.footer = buildFooter(themeOpts);
|
|
847
|
+
view.displayModuleHeader = moduleHeader(themeOpts);
|
|
848
|
+
view.favicon = getFavicon(themeOpts);
|
|
849
|
+
view.dynamicStyle = createDynamicStyleSheet(themeOpts);
|
|
850
|
+
view.dynamicStyleSrc = returnPathOfStyleSrc(themeOpts);
|
|
851
|
+
view.dynamicScript = createDynamicsScripts(themeOpts);
|
|
852
|
+
view.dynamicScriptSrc = returnPathOfScriptScr(themeOpts);
|
|
853
|
+
view.includeScript = includeScript(themeOpts, outdir);
|
|
854
|
+
view.includeCss = includeCss(themeOpts, outdir);
|
|
855
|
+
view.meta = getMetaTagData(themeOpts);
|
|
856
|
+
view.theme = getTheme(themeOpts);
|
|
972
857
|
// once for all
|
|
973
858
|
view.sidebar = buildSidebar(members);
|
|
974
|
-
view.navbar = buildNavbar();
|
|
975
|
-
view.resizeable = resizeable();
|
|
976
|
-
view.codepen = codepen();
|
|
977
|
-
view.baseURL = getBaseURL();
|
|
859
|
+
view.navbar = buildNavbar(themeOpts);
|
|
860
|
+
view.resizeable = resizeable(themeOpts);
|
|
861
|
+
view.codepen = codepen(themeOpts);
|
|
862
|
+
view.baseURL = getBaseURL(themeOpts);
|
|
978
863
|
view.excludeInherited = Boolean(themeOpts.exclude_inherited);
|
|
979
864
|
attachModuleSymbols(
|
|
980
865
|
find({ longname: { left: 'module:' } }),
|
|
981
866
|
members.modules
|
|
982
867
|
);
|
|
983
868
|
|
|
869
|
+
// added by clean-jsdoc-theme-devs
|
|
984
870
|
// output search file if search
|
|
985
|
-
|
|
986
871
|
if (hasSearch) {
|
|
987
872
|
fs.mkPath(path.join(outdir, 'data'));
|
|
988
873
|
fs.writeFileSync(
|
|
989
874
|
path.join(outdir, 'data', 'search.json'),
|
|
990
875
|
JSON.stringify({
|
|
991
|
-
list: searchListArray
|
|
876
|
+
list: searchListArray,
|
|
992
877
|
})
|
|
993
878
|
);
|
|
994
879
|
}
|
|
@@ -999,16 +884,16 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
999
884
|
}
|
|
1000
885
|
|
|
1001
886
|
if (members.globals.length) {
|
|
1002
|
-
generate('
|
|
887
|
+
generate('Global', [{ kind: 'globalobj' }], globalUrl);
|
|
1003
888
|
}
|
|
1004
889
|
|
|
1005
890
|
// index page displays information from package.json and lists files
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
891
|
+
files = find({ kind: 'file' });
|
|
892
|
+
packages = find({ kind: 'package' });
|
|
893
|
+
// added by clean-jsdoc-theme-devs
|
|
894
|
+
const homepageTitle = themeOpts.homepageTitle || 'Home';
|
|
1009
895
|
|
|
1010
896
|
generate(
|
|
1011
|
-
'',
|
|
1012
897
|
homepageTitle,
|
|
1013
898
|
packages
|
|
1014
899
|
.concat([
|
|
@@ -1017,83 +902,72 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1017
902
|
readme: opts.readme,
|
|
1018
903
|
longname: opts.mainpagetitle
|
|
1019
904
|
? opts.mainpagetitle
|
|
1020
|
-
: 'Main Page'
|
|
1021
|
-
}
|
|
905
|
+
: 'Main Page',
|
|
906
|
+
},
|
|
1022
907
|
])
|
|
1023
908
|
.concat(files),
|
|
1024
909
|
indexUrl
|
|
1025
910
|
);
|
|
1026
911
|
|
|
1027
912
|
// set up the lists that we'll use to generate pages
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
913
|
+
classes = taffy(members.classes);
|
|
914
|
+
modules = taffy(members.modules);
|
|
915
|
+
namespaces = taffy(members.namespaces);
|
|
916
|
+
mixins = taffy(members.mixins);
|
|
917
|
+
externals = taffy(members.externals);
|
|
918
|
+
interfaces = taffy(members.interfaces);
|
|
1034
919
|
|
|
1035
920
|
Object.keys(helper.longnameToUrl).forEach(function (longname) {
|
|
1036
|
-
|
|
921
|
+
const myClasses = helper.find(classes, { longname: longname });
|
|
922
|
+
const myExternals = helper.find(externals, { longname: longname });
|
|
923
|
+
const myInterfaces = helper.find(interfaces, { longname: longname });
|
|
924
|
+
const myMixins = helper.find(mixins, { longname: longname });
|
|
925
|
+
const myModules = helper.find(modules, { longname: longname });
|
|
926
|
+
const myNamespaces = helper.find(namespaces, { longname: longname });
|
|
1037
927
|
|
|
1038
928
|
if (myModules.length) {
|
|
1039
929
|
generate(
|
|
1040
|
-
|
|
1041
|
-
myModules[0].name,
|
|
930
|
+
`Module: ${myModules[0].name}`,
|
|
1042
931
|
myModules,
|
|
1043
932
|
helper.longnameToUrl[longname]
|
|
1044
933
|
);
|
|
1045
934
|
}
|
|
1046
935
|
|
|
1047
|
-
var myClasses = helper.find(classes, { longname: longname });
|
|
1048
|
-
|
|
1049
936
|
if (myClasses.length) {
|
|
1050
937
|
generate(
|
|
1051
|
-
|
|
1052
|
-
myClasses[0].name,
|
|
938
|
+
`Class: ${myClasses[0].name}`,
|
|
1053
939
|
myClasses,
|
|
1054
940
|
helper.longnameToUrl[longname]
|
|
1055
941
|
);
|
|
1056
942
|
}
|
|
1057
943
|
|
|
1058
|
-
var myNamespaces = helper.find(namespaces, { longname: longname });
|
|
1059
|
-
|
|
1060
944
|
if (myNamespaces.length) {
|
|
1061
945
|
generate(
|
|
1062
|
-
|
|
1063
|
-
myNamespaces[0].name,
|
|
946
|
+
`Namespace: ${myNamespaces[0].name}`,
|
|
1064
947
|
myNamespaces,
|
|
1065
948
|
helper.longnameToUrl[longname]
|
|
1066
949
|
);
|
|
1067
950
|
}
|
|
1068
951
|
|
|
1069
|
-
var myMixins = helper.find(mixins, { longname: longname });
|
|
1070
|
-
|
|
1071
952
|
if (myMixins.length) {
|
|
1072
953
|
generate(
|
|
1073
|
-
|
|
1074
|
-
myMixins[0].name,
|
|
954
|
+
`Mixin: ${myMixins[0].name}`,
|
|
1075
955
|
myMixins,
|
|
1076
956
|
helper.longnameToUrl[longname]
|
|
1077
957
|
);
|
|
1078
958
|
}
|
|
1079
959
|
|
|
1080
|
-
var myExternals = helper.find(externals, { longname: longname });
|
|
1081
|
-
|
|
1082
960
|
if (myExternals.length) {
|
|
1083
961
|
generate(
|
|
1084
|
-
|
|
1085
|
-
myExternals[0].name,
|
|
962
|
+
`External: ${myExternals[0].name}`,
|
|
1086
963
|
myExternals,
|
|
1087
964
|
helper.longnameToUrl[longname]
|
|
1088
965
|
);
|
|
1089
966
|
}
|
|
1090
967
|
|
|
1091
|
-
var myInterfaces = helper.find(interfaces, { longname: longname });
|
|
1092
|
-
|
|
1093
968
|
if (myInterfaces.length) {
|
|
1094
969
|
generate(
|
|
1095
|
-
|
|
1096
|
-
myInterfaces[0].name,
|
|
970
|
+
`Interface: ${myInterfaces[0].name}`,
|
|
1097
971
|
myInterfaces,
|
|
1098
972
|
helper.longnameToUrl[longname]
|
|
1099
973
|
);
|
|
@@ -1102,15 +976,15 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1102
976
|
|
|
1103
977
|
// TODO: move the tutorial functions to templateHelper.js
|
|
1104
978
|
function generateTutorial(title, tutorial, filename) {
|
|
1105
|
-
|
|
979
|
+
const tutorialData = {
|
|
1106
980
|
title: title,
|
|
1107
981
|
header: tutorial.title,
|
|
1108
982
|
content: tutorial.parse(),
|
|
1109
|
-
children: tutorial.children
|
|
983
|
+
children: tutorial.children,
|
|
1110
984
|
};
|
|
1111
985
|
|
|
1112
|
-
|
|
1113
|
-
|
|
986
|
+
const tutorialPath = path.join(outdir, filename);
|
|
987
|
+
let html = view.render('tutorial.tmpl', tutorialData);
|
|
1114
988
|
|
|
1115
989
|
// yes, you can use {@link} in tutorials too!
|
|
1116
990
|
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
|
@@ -1123,10 +997,10 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1123
997
|
}
|
|
1124
998
|
|
|
1125
999
|
// tutorials can have only one parent so there is no risk for loops
|
|
1126
|
-
function saveChildren(
|
|
1127
|
-
|
|
1000
|
+
function saveChildren({ children }) {
|
|
1001
|
+
children.forEach(function (child) {
|
|
1128
1002
|
generateTutorial(
|
|
1129
|
-
|
|
1003
|
+
`Tutorial: ${child.title}`,
|
|
1130
1004
|
child,
|
|
1131
1005
|
helper.tutorialToUrl(child.name)
|
|
1132
1006
|
);
|