clean-jsdoc-theme 4.1.10 → 4.1.12
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 +2 -2
- package/clean-jsdoc-theme-defaults.js +37 -0
- package/clean-jsdoc-theme-helper.js +167 -0
- package/package.json +54 -51
- package/publish.js +281 -431
- package/tmpl/container.tmpl +21 -10
- package/tmpl/method.tmpl +19 -0
- package/tmpl/params.tmpl +8 -1
package/publish.js
CHANGED
|
@@ -1,104 +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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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 =
|
|
32
49
|
themeOpts.search === undefined ? true : Boolean(themeOpts.search);
|
|
33
50
|
|
|
34
51
|
// eslint-disable-next-line no-restricted-globals
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var SECTION_TYPE = {
|
|
38
|
-
Classes: 'Classes',
|
|
39
|
-
Modules: 'Modules',
|
|
40
|
-
Externals: 'Externals',
|
|
41
|
-
Events: 'Events',
|
|
42
|
-
Namespaces: 'Namespaces',
|
|
43
|
-
Mixins: 'Mixins',
|
|
44
|
-
Tutorials: 'Tutorials',
|
|
45
|
-
Interfaces: 'Interfaces',
|
|
46
|
-
Global: 'Global'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
var defaultSections = [
|
|
50
|
-
SECTION_TYPE.Modules,
|
|
51
|
-
SECTION_TYPE.Classes,
|
|
52
|
-
SECTION_TYPE.Externals,
|
|
53
|
-
SECTION_TYPE.Events,
|
|
54
|
-
SECTION_TYPE.Namespaces,
|
|
55
|
-
SECTION_TYPE.Mixins,
|
|
56
|
-
SECTION_TYPE.Tutorials,
|
|
57
|
-
SECTION_TYPE.Interfaces,
|
|
58
|
-
SECTION_TYPE.Global
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
var HTML_MINIFY_OPTIONS = {
|
|
62
|
-
collapseWhitespace: true,
|
|
63
|
-
removeComments: true,
|
|
64
|
-
html5: true,
|
|
65
|
-
minifyJS: true,
|
|
66
|
-
minifyCSS: true
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function copyStaticFolder() {
|
|
70
|
-
var staticDir = themeOpts.static_dir || undefined;
|
|
71
|
-
|
|
72
|
-
if (staticDir) {
|
|
73
|
-
for (var i = 0; i < staticDir.length; i++) {
|
|
74
|
-
var output = path.join(outdir, staticDir[i]);
|
|
75
|
-
|
|
76
|
-
fse.copySync(staticDir[i], output);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
copyStaticFolder();
|
|
82
|
-
|
|
83
|
-
function copyToOutputFolder(filePath) {
|
|
84
|
-
var filePathNormalized = path.normalize(filePath);
|
|
85
|
-
|
|
86
|
-
fs.copyFileSync(filePathNormalized, outdir);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function copyToOutputFolderFromArray(filePathArray) {
|
|
90
|
-
var i = 0;
|
|
91
|
-
var outputList = [];
|
|
52
|
+
let outdir = path.normalize(env.opts.destination);
|
|
92
53
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
copyToOutputFolder(filePathArray[i]);
|
|
96
|
-
outputList.push(path.basename(filePathArray[i]));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return outputList;
|
|
101
|
-
}
|
|
54
|
+
// copy static folders
|
|
55
|
+
copyStaticFolder(themeOpts, outdir);
|
|
102
56
|
|
|
103
57
|
function find(spec) {
|
|
104
58
|
return helper.find(data, spec);
|
|
@@ -108,7 +62,7 @@ function tutoriallink(tutorial) {
|
|
|
108
62
|
return helper.toTutorial(tutorial, null, {
|
|
109
63
|
tag: 'em',
|
|
110
64
|
classname: 'disabled',
|
|
111
|
-
prefix: 'Tutorial: '
|
|
65
|
+
prefix: 'Tutorial: ',
|
|
112
66
|
});
|
|
113
67
|
}
|
|
114
68
|
|
|
@@ -116,53 +70,62 @@ function getAncestorLinks(doclet) {
|
|
|
116
70
|
return helper.getAncestorLinks(data, doclet);
|
|
117
71
|
}
|
|
118
72
|
|
|
119
|
-
function hashToLink(doclet, hash) {
|
|
73
|
+
function hashToLink(doclet, hash, dependencies) {
|
|
74
|
+
let url;
|
|
75
|
+
|
|
120
76
|
if (!/^(#.+)/.test(hash)) {
|
|
121
77
|
return hash;
|
|
122
78
|
}
|
|
123
79
|
|
|
124
|
-
|
|
125
|
-
|
|
80
|
+
url = helper.createLink(doclet, dependencies);
|
|
126
81
|
url = url.replace(/(#.+|$)/, hash);
|
|
127
82
|
|
|
128
|
-
return
|
|
83
|
+
return `<a href="${url}">${hash}</a>`;
|
|
129
84
|
}
|
|
130
85
|
|
|
131
|
-
function needsSignature(
|
|
132
|
-
|
|
86
|
+
function needsSignature({ kind, type, meta }) {
|
|
87
|
+
let needsSig = false;
|
|
133
88
|
|
|
134
89
|
// function and class definitions always get a signature
|
|
135
|
-
if (
|
|
90
|
+
if (kind === 'function' || kind === 'class') {
|
|
136
91
|
needsSig = true;
|
|
137
92
|
}
|
|
93
|
+
|
|
138
94
|
// typedefs that contain functions get a signature, too
|
|
139
|
-
else if (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
doclet.type.names &&
|
|
143
|
-
doclet.type.names.length
|
|
144
|
-
) {
|
|
145
|
-
for (var i = 0, l = doclet.type.names.length; i < l; i++) {
|
|
146
|
-
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') {
|
|
147
98
|
needsSig = true;
|
|
148
99
|
break;
|
|
149
100
|
}
|
|
150
101
|
}
|
|
151
102
|
}
|
|
152
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
|
+
|
|
153
116
|
return needsSig;
|
|
154
117
|
}
|
|
155
118
|
|
|
156
|
-
function getSignatureAttributes(
|
|
157
|
-
|
|
119
|
+
function getSignatureAttributes({ optional, nullable }) {
|
|
120
|
+
const attributes = [];
|
|
158
121
|
|
|
159
|
-
if (
|
|
122
|
+
if (optional) {
|
|
160
123
|
attributes.push('opt');
|
|
161
124
|
}
|
|
162
125
|
|
|
163
|
-
if (
|
|
126
|
+
if (nullable === true) {
|
|
164
127
|
attributes.push('nullable');
|
|
165
|
-
} else if (
|
|
128
|
+
} else if (nullable === false) {
|
|
166
129
|
attributes.push('non-null');
|
|
167
130
|
}
|
|
168
131
|
|
|
@@ -170,19 +133,17 @@ function getSignatureAttributes(item) {
|
|
|
170
133
|
}
|
|
171
134
|
|
|
172
135
|
function updateItemName(item) {
|
|
173
|
-
|
|
174
|
-
|
|
136
|
+
const attributes = getSignatureAttributes(item);
|
|
137
|
+
let itemName = item.name || '';
|
|
175
138
|
|
|
176
139
|
if (item.variable) {
|
|
177
140
|
itemName = '…' + itemName;
|
|
178
141
|
}
|
|
179
142
|
|
|
180
143
|
if (attributes && attributes.length) {
|
|
181
|
-
itemName =
|
|
182
|
-
'
|
|
183
|
-
|
|
184
|
-
attributes.join(', ')
|
|
185
|
-
);
|
|
144
|
+
itemName = `${itemName}<span class="signature-attributes">${attributes.join(
|
|
145
|
+
', '
|
|
146
|
+
)}</span>`;
|
|
186
147
|
}
|
|
187
148
|
|
|
188
149
|
return itemName;
|
|
@@ -190,14 +151,12 @@ function updateItemName(item) {
|
|
|
190
151
|
|
|
191
152
|
function addParamAttributes(params) {
|
|
192
153
|
return params
|
|
193
|
-
.filter(
|
|
194
|
-
return param.name && param.name.indexOf('.') === -1;
|
|
195
|
-
})
|
|
154
|
+
.filter(({ name }) => name && !name.includes('.'))
|
|
196
155
|
.map(updateItemName);
|
|
197
156
|
}
|
|
198
157
|
|
|
199
158
|
function buildItemTypeStrings(item) {
|
|
200
|
-
|
|
159
|
+
const types = [];
|
|
201
160
|
|
|
202
161
|
if (item && item.type && item.type.names) {
|
|
203
162
|
item.type.names.forEach(function (name) {
|
|
@@ -209,17 +168,17 @@ function buildItemTypeStrings(item) {
|
|
|
209
168
|
}
|
|
210
169
|
|
|
211
170
|
function buildAttribsString(attribs) {
|
|
212
|
-
|
|
171
|
+
let attribsString = '';
|
|
213
172
|
|
|
214
173
|
if (attribs && attribs.length) {
|
|
215
|
-
|
|
174
|
+
htmlsafe(`(${attribs.join(', ')}) `);
|
|
216
175
|
}
|
|
217
176
|
|
|
218
177
|
return attribsString;
|
|
219
178
|
}
|
|
220
179
|
|
|
221
180
|
function addNonParamAttributes(items) {
|
|
222
|
-
|
|
181
|
+
let types = [];
|
|
223
182
|
|
|
224
183
|
items.forEach(function (item) {
|
|
225
184
|
types = types.concat(buildItemTypeStrings(item));
|
|
@@ -229,9 +188,9 @@ function addNonParamAttributes(items) {
|
|
|
229
188
|
}
|
|
230
189
|
|
|
231
190
|
function addSignatureParams(f) {
|
|
232
|
-
|
|
191
|
+
const params = f.params ? addParamAttributes(f.params) : [];
|
|
233
192
|
|
|
234
|
-
f.signature =
|
|
193
|
+
f.signature = `${f.signature || ''}(${params.join(', ')})`;
|
|
235
194
|
}
|
|
236
195
|
|
|
237
196
|
function addSignatureReturns(f) {
|
|
@@ -260,43 +219,38 @@ function addSignatureReturns(f) {
|
|
|
260
219
|
returnTypes = addNonParamAttributes(source);
|
|
261
220
|
}
|
|
262
221
|
if (returnTypes.length) {
|
|
263
|
-
returnTypesString = ` → ${attribsString}{${returnTypes.join(
|
|
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,109 +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 moduleHeader() {
|
|
434
|
-
var displayModuleHeader = themeOpts.displayModuleHeader || false;
|
|
435
|
-
|
|
436
|
-
return displayModuleHeader;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
function getFavicon() {
|
|
440
|
-
var favicon = themeOpts.favicon || undefined;
|
|
441
|
-
|
|
442
|
-
return favicon;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// function copy
|
|
446
|
-
function createDynamicStyleSheet() {
|
|
447
|
-
var styleClass = themeOpts.create_style || undefined;
|
|
448
|
-
/* prettier-ignore-start */
|
|
449
|
-
|
|
450
|
-
return styleClass;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function createDynamicsScripts() {
|
|
454
|
-
var scripts = themeOpts.add_scripts || undefined;
|
|
455
|
-
|
|
456
|
-
return scripts;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function returnPathOfScriptScr() {
|
|
460
|
-
var scriptPath = themeOpts.add_script_path || undefined;
|
|
461
|
-
|
|
462
|
-
return scriptPath;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function returnPathOfStyleSrc() {
|
|
466
|
-
var stylePath = themeOpts.add_style_path || undefined;
|
|
467
|
-
|
|
468
|
-
return stylePath;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
function includeCss() {
|
|
472
|
-
var stylePath = themeOpts.include_css || undefined;
|
|
473
|
-
|
|
474
|
-
if (stylePath) {
|
|
475
|
-
stylePath = copyToOutputFolderFromArray(stylePath);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
return stylePath;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
function resizeable() {
|
|
482
|
-
var resizeOpts = themeOpts.resizeable || {};
|
|
483
|
-
|
|
484
|
-
return resizeOpts;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function codepen() {
|
|
488
|
-
var codepenOpts = themeOpts.codepen || {};
|
|
489
|
-
|
|
490
|
-
return codepenOpts;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
function includeScript() {
|
|
494
|
-
var scriptPath = themeOpts.include_js || undefined;
|
|
495
|
-
|
|
496
|
-
if (scriptPath) {
|
|
497
|
-
scriptPath = copyToOutputFolderFromArray(scriptPath);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
return scriptPath;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function getMetaTagData() {
|
|
504
|
-
var meta = themeOpts.meta || undefined;
|
|
505
|
-
|
|
506
|
-
return meta;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function getTheme() {
|
|
510
|
-
var theme = themeOpts.default_theme || 'dark';
|
|
511
|
-
|
|
512
|
-
return theme;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function getBaseURL() {
|
|
516
|
-
return themeOpts.base_url;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
381
|
function buildSidebarMembers({
|
|
520
382
|
items,
|
|
521
383
|
itemHeading,
|
|
522
384
|
itemsSeen,
|
|
523
385
|
linktoFn,
|
|
524
|
-
sectionName
|
|
386
|
+
sectionName,
|
|
525
387
|
}) {
|
|
526
388
|
const navProps = {
|
|
527
389
|
name: itemHeading,
|
|
528
390
|
items: [],
|
|
529
|
-
id: nanoid()
|
|
391
|
+
id: nanoid(),
|
|
530
392
|
};
|
|
531
393
|
|
|
532
394
|
if (items.length) {
|
|
@@ -536,7 +398,7 @@ function buildSidebarMembers({
|
|
|
536
398
|
anchor: item.longname
|
|
537
399
|
? linktoFn(item.longname, item.name)
|
|
538
400
|
: linktoFn('', item.name),
|
|
539
|
-
children: []
|
|
401
|
+
children: [],
|
|
540
402
|
};
|
|
541
403
|
|
|
542
404
|
var methods =
|
|
@@ -547,8 +409,8 @@ function buildSidebarMembers({
|
|
|
547
409
|
kind: 'function',
|
|
548
410
|
memberof: item.longname,
|
|
549
411
|
inherited: {
|
|
550
|
-
'!is': Boolean(themeOpts.exclude_inherited)
|
|
551
|
-
}
|
|
412
|
+
'!is': Boolean(themeOpts.exclude_inherited),
|
|
413
|
+
},
|
|
552
414
|
});
|
|
553
415
|
|
|
554
416
|
if (!hasOwnProp.call(itemsSeen, item.longname)) {
|
|
@@ -561,7 +423,7 @@ function buildSidebarMembers({
|
|
|
561
423
|
searchListArray.push({
|
|
562
424
|
title: item.name,
|
|
563
425
|
link: linktoFn(item.longname, item.name),
|
|
564
|
-
description: item.description
|
|
426
|
+
description: item.description,
|
|
565
427
|
});
|
|
566
428
|
}
|
|
567
429
|
|
|
@@ -569,7 +431,7 @@ function buildSidebarMembers({
|
|
|
569
431
|
methods.forEach(function (method) {
|
|
570
432
|
const itemChild = {
|
|
571
433
|
name: method.longName,
|
|
572
|
-
link: linktoFn(method.longname, method.name)
|
|
434
|
+
link: linktoFn(method.longname, method.name),
|
|
573
435
|
};
|
|
574
436
|
|
|
575
437
|
currentItem.children.push(itemChild);
|
|
@@ -586,7 +448,7 @@ function buildSidebarMembers({
|
|
|
586
448
|
searchListArray.push({
|
|
587
449
|
title: method.longname,
|
|
588
450
|
link: linktoFn(method.longname, name),
|
|
589
|
-
description: item.classdesc
|
|
451
|
+
description: item.classdesc,
|
|
590
452
|
});
|
|
591
453
|
}
|
|
592
454
|
});
|
|
@@ -609,15 +471,24 @@ function linktoExternal(longName, name) {
|
|
|
609
471
|
return linkto(longName, name.replace(/(^"|"$)/g, ''));
|
|
610
472
|
}
|
|
611
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
|
+
*/
|
|
612
480
|
function buildNavbar() {
|
|
613
481
|
return {
|
|
614
482
|
menu: themeOpts.menu || undefined,
|
|
615
|
-
search: hasSearch
|
|
483
|
+
search: hasSearch,
|
|
616
484
|
};
|
|
617
485
|
}
|
|
618
486
|
|
|
619
487
|
/**
|
|
620
|
-
*
|
|
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
|
+
*
|
|
621
492
|
* @param {object} members The members that will be used to create the sidebar.
|
|
622
493
|
* @param {array<object>} members.classes
|
|
623
494
|
* @param {array<object>} members.externals
|
|
@@ -636,18 +507,18 @@ function buildSidebar(members) {
|
|
|
636
507
|
var isHTML = RegExp.prototype.test.bind(/(<([^>]+)>)/i);
|
|
637
508
|
|
|
638
509
|
var nav = {
|
|
639
|
-
sections: []
|
|
510
|
+
sections: [],
|
|
640
511
|
};
|
|
641
512
|
|
|
642
513
|
if (!isHTML(title)) {
|
|
643
514
|
nav.title = {
|
|
644
515
|
title,
|
|
645
|
-
isHTML: false
|
|
516
|
+
isHTML: false,
|
|
646
517
|
};
|
|
647
518
|
} else {
|
|
648
519
|
nav.title = {
|
|
649
520
|
title,
|
|
650
|
-
isHTML: true
|
|
521
|
+
isHTML: true,
|
|
651
522
|
};
|
|
652
523
|
}
|
|
653
524
|
|
|
@@ -663,7 +534,7 @@ function buildSidebar(members) {
|
|
|
663
534
|
items: members.modules,
|
|
664
535
|
itemsSeen: seen,
|
|
665
536
|
linktoFn: linkto,
|
|
666
|
-
sectionName: SECTION_TYPE.Modules
|
|
537
|
+
sectionName: SECTION_TYPE.Modules,
|
|
667
538
|
}),
|
|
668
539
|
|
|
669
540
|
[SECTION_TYPE.Classes]: buildSidebarMembers({
|
|
@@ -671,7 +542,7 @@ function buildSidebar(members) {
|
|
|
671
542
|
items: members.classes,
|
|
672
543
|
itemsSeen: seen,
|
|
673
544
|
linktoFn: linkto,
|
|
674
|
-
sectionName: SECTION_TYPE.Classes
|
|
545
|
+
sectionName: SECTION_TYPE.Classes,
|
|
675
546
|
}),
|
|
676
547
|
|
|
677
548
|
[SECTION_TYPE.Externals]: buildSidebarMembers({
|
|
@@ -679,7 +550,7 @@ function buildSidebar(members) {
|
|
|
679
550
|
items: members.externals,
|
|
680
551
|
itemsSeen: seen,
|
|
681
552
|
linktoFn: linktoExternal,
|
|
682
|
-
sectionName: SECTION_TYPE.Externals
|
|
553
|
+
sectionName: SECTION_TYPE.Externals,
|
|
683
554
|
}),
|
|
684
555
|
|
|
685
556
|
[SECTION_TYPE.Events]: buildSidebarMembers({
|
|
@@ -687,7 +558,7 @@ function buildSidebar(members) {
|
|
|
687
558
|
items: members.events,
|
|
688
559
|
itemsSeen: seen,
|
|
689
560
|
linktoFn: linkto,
|
|
690
|
-
sectionName: SECTION_TYPE.Events
|
|
561
|
+
sectionName: SECTION_TYPE.Events,
|
|
691
562
|
}),
|
|
692
563
|
|
|
693
564
|
[SECTION_TYPE.Namespaces]: buildSidebarMembers({
|
|
@@ -695,7 +566,7 @@ function buildSidebar(members) {
|
|
|
695
566
|
items: members.namespaces,
|
|
696
567
|
itemsSeen: seen,
|
|
697
568
|
linktoFn: linkto,
|
|
698
|
-
sectionName: SECTION_TYPE.Namespaces
|
|
569
|
+
sectionName: SECTION_TYPE.Namespaces,
|
|
699
570
|
}),
|
|
700
571
|
|
|
701
572
|
[SECTION_TYPE.Mixins]: buildSidebarMembers({
|
|
@@ -703,7 +574,7 @@ function buildSidebar(members) {
|
|
|
703
574
|
items: members.mixins,
|
|
704
575
|
itemsSeen: seen,
|
|
705
576
|
linktoFn: linkto,
|
|
706
|
-
sectionName: SECTION_TYPE.Mixins
|
|
577
|
+
sectionName: SECTION_TYPE.Mixins,
|
|
707
578
|
}),
|
|
708
579
|
|
|
709
580
|
[SECTION_TYPE.Tutorials]: buildSidebarMembers({
|
|
@@ -711,7 +582,7 @@ function buildSidebar(members) {
|
|
|
711
582
|
items: members.tutorials,
|
|
712
583
|
itemsSeen: seenTutorials,
|
|
713
584
|
linktoFn: linktoTutorial,
|
|
714
|
-
sectionName: SECTION_TYPE.Tutorials
|
|
585
|
+
sectionName: SECTION_TYPE.Tutorials,
|
|
715
586
|
}),
|
|
716
587
|
|
|
717
588
|
[SECTION_TYPE.Interfaces]: buildSidebarMembers({
|
|
@@ -719,7 +590,7 @@ function buildSidebar(members) {
|
|
|
719
590
|
items: members.interfaces,
|
|
720
591
|
itemsSeen: seen,
|
|
721
592
|
linktoFn: linkto,
|
|
722
|
-
sectionName: SECTION_TYPE.Interfaces
|
|
593
|
+
sectionName: SECTION_TYPE.Interfaces,
|
|
723
594
|
}),
|
|
724
595
|
|
|
725
596
|
[SECTION_TYPE.Global]: buildSidebarMembers({
|
|
@@ -727,8 +598,8 @@ function buildSidebar(members) {
|
|
|
727
598
|
items: members.globals,
|
|
728
599
|
itemsSeen: seenGlobal,
|
|
729
600
|
linktoFn: linkto,
|
|
730
|
-
sectionName: SECTION_TYPE.Global
|
|
731
|
-
})
|
|
601
|
+
sectionName: SECTION_TYPE.Global,
|
|
602
|
+
}),
|
|
732
603
|
};
|
|
733
604
|
|
|
734
605
|
sectionsOrder.forEach((section) => {
|
|
@@ -746,77 +617,72 @@ function buildSidebar(members) {
|
|
|
746
617
|
return nav;
|
|
747
618
|
}
|
|
748
619
|
|
|
749
|
-
/**
|
|
750
|
-
* Currently for some reason yields markdown is
|
|
751
|
-
* not processed by jsdoc. So, we are processing it here
|
|
752
|
-
*
|
|
753
|
-
* @param {Array<{type: string, description: string}>} yields
|
|
754
|
-
*/
|
|
755
|
-
function getProcessedYield(yields) {
|
|
756
|
-
if (!Array.isArray(yields)) return []
|
|
757
|
-
|
|
758
|
-
return yields.map((y) => ({ ...y, description: mdToHTMLConverter.makeHtml(y.description) }))
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
|
|
762
620
|
/**
|
|
763
621
|
@param {TAFFY} taffyData See <http://taffydb.com/>.
|
|
764
622
|
@param {object} opts
|
|
765
623
|
@param {Tutorial} tutorials
|
|
766
624
|
*/
|
|
767
625
|
exports.publish = function (taffyData, opts, tutorials) {
|
|
768
|
-
|
|
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;
|
|
769
648
|
|
|
770
|
-
|
|
771
|
-
var conf = env.conf.templates || {};
|
|
649
|
+
data = taffyData;
|
|
772
650
|
|
|
651
|
+
conf = env.conf.templates || {};
|
|
773
652
|
conf.default = conf.default || {};
|
|
774
653
|
|
|
775
|
-
|
|
776
|
-
|
|
654
|
+
templatePath = path.normalize(opts.template);
|
|
777
655
|
view = new template.Template(path.join(templatePath, 'tmpl'));
|
|
778
656
|
|
|
779
657
|
// claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness
|
|
780
658
|
// doesn't try to hand them out later
|
|
781
|
-
|
|
659
|
+
indexUrl = helper.getUniqueFilename('index');
|
|
782
660
|
// don't call registerLink() on this one! 'index' is also a valid longname
|
|
783
661
|
|
|
784
|
-
|
|
785
|
-
|
|
662
|
+
globalUrl = helper.getUniqueFilename('global');
|
|
786
663
|
helper.registerLink('global', globalUrl);
|
|
787
664
|
|
|
788
665
|
// set up templating
|
|
789
666
|
view.layout = conf.default.layoutFile
|
|
790
|
-
? path.
|
|
791
|
-
path.dirname(conf.default.layoutFile),
|
|
792
|
-
path.basename(conf.default.layoutFile)
|
|
793
|
-
)
|
|
667
|
+
? path.resolve(conf.default.layoutFile)
|
|
794
668
|
: 'layout.tmpl';
|
|
795
669
|
|
|
796
670
|
// set up tutorials for helper
|
|
797
671
|
helper.setTutorials(tutorials);
|
|
798
672
|
|
|
799
673
|
data = helper.prune(data);
|
|
800
|
-
|
|
801
674
|
data.sort('longname, version, since');
|
|
802
675
|
helper.addEventListeners(data);
|
|
803
676
|
|
|
804
|
-
|
|
805
|
-
|
|
677
|
+
data().each((doclet) => {
|
|
678
|
+
let sourcePath;
|
|
806
679
|
|
|
807
|
-
data().each(function (doclet) {
|
|
808
680
|
doclet.attribs = '';
|
|
809
681
|
|
|
810
682
|
if (doclet.examples) {
|
|
811
|
-
doclet.examples = doclet.examples.map(
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
if (example === undefined) {
|
|
815
|
-
return {
|
|
816
|
-
caption: '',
|
|
817
|
-
code: ''
|
|
818
|
-
};
|
|
819
|
-
}
|
|
683
|
+
doclet.examples = doclet.examples.map((example) => {
|
|
684
|
+
let caption;
|
|
685
|
+
let code;
|
|
820
686
|
|
|
821
687
|
if (
|
|
822
688
|
example.match(
|
|
@@ -829,7 +695,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
829
695
|
|
|
830
696
|
return {
|
|
831
697
|
caption: caption || '',
|
|
832
|
-
code: code || example
|
|
698
|
+
code: code || example,
|
|
833
699
|
};
|
|
834
700
|
});
|
|
835
701
|
}
|
|
@@ -840,48 +706,43 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
840
706
|
}
|
|
841
707
|
|
|
842
708
|
// build a list of source files
|
|
843
|
-
var sourcePath;
|
|
844
|
-
|
|
845
709
|
if (doclet.meta) {
|
|
846
710
|
sourcePath = getPathFromDoclet(doclet);
|
|
847
711
|
sourceFiles[sourcePath] = {
|
|
848
712
|
resolved: sourcePath,
|
|
849
|
-
shortened: null
|
|
713
|
+
shortened: null,
|
|
850
714
|
};
|
|
851
715
|
if (sourceFilePaths.indexOf(sourcePath) === -1) {
|
|
852
716
|
sourceFilePaths.push(sourcePath);
|
|
853
717
|
}
|
|
854
718
|
}
|
|
855
719
|
|
|
720
|
+
// added by clean-jsdoc-theme-dev.
|
|
721
|
+
// to process yields.
|
|
856
722
|
if (doclet.yields) {
|
|
857
|
-
doclet.yields = getProcessedYield(doclet.yields)
|
|
723
|
+
doclet.yields = getProcessedYield(doclet.yields);
|
|
858
724
|
}
|
|
859
725
|
});
|
|
860
726
|
|
|
861
727
|
// update outdir if necessary, then create outdir
|
|
862
|
-
|
|
863
|
-
|
|
728
|
+
packageInfo = (find({ kind: 'package' }) || [])[0];
|
|
864
729
|
if (packageInfo && packageInfo.name) {
|
|
865
730
|
outdir = path.join(outdir, packageInfo.name, packageInfo.version || '');
|
|
866
731
|
}
|
|
867
732
|
fs.mkPath(outdir);
|
|
868
733
|
|
|
869
734
|
// copy the template's static files to outdir
|
|
870
|
-
|
|
871
|
-
|
|
735
|
+
fromDir = path.join(templatePath, 'static');
|
|
736
|
+
staticFiles = fs.ls(fromDir, 3);
|
|
872
737
|
|
|
873
|
-
staticFiles.forEach(
|
|
874
|
-
|
|
738
|
+
staticFiles.forEach((fileName) => {
|
|
739
|
+
const toDir = fs.toDir(fileName.replace(fromDir, outdir));
|
|
875
740
|
|
|
876
741
|
fs.mkPath(toDir);
|
|
877
742
|
fs.copyFileSync(fileName, toDir);
|
|
878
743
|
});
|
|
879
744
|
|
|
880
745
|
// copy user-specified static files to outdir
|
|
881
|
-
var staticFilePaths;
|
|
882
|
-
var staticFileFilter;
|
|
883
|
-
var staticFileScanner;
|
|
884
|
-
|
|
885
746
|
if (conf.default.staticFiles) {
|
|
886
747
|
// The canonical property name is `include`. We accept `paths` for backwards compatibility
|
|
887
748
|
// with a bug in JSDoc 3.2.x.
|
|
@@ -894,16 +755,17 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
894
755
|
);
|
|
895
756
|
staticFileScanner = new (require('jsdoc/src/scanner').Scanner)();
|
|
896
757
|
|
|
897
|
-
staticFilePaths.forEach(
|
|
898
|
-
|
|
758
|
+
staticFilePaths.forEach((filePath) => {
|
|
759
|
+
filePath = path.resolve(env.pwd, filePath);
|
|
760
|
+
const extraStaticFiles = staticFileScanner.scan(
|
|
899
761
|
[filePath],
|
|
900
762
|
10,
|
|
901
763
|
staticFileFilter
|
|
902
764
|
);
|
|
903
765
|
|
|
904
|
-
extraStaticFiles.forEach(
|
|
905
|
-
|
|
906
|
-
|
|
766
|
+
extraStaticFiles.forEach((fileName) => {
|
|
767
|
+
const sourcePath = fs.toDir(filePath);
|
|
768
|
+
const toDir = fs.toDir(fileName.replace(sourcePath, outdir));
|
|
907
769
|
|
|
908
770
|
fs.mkPath(toDir);
|
|
909
771
|
fs.copyFileSync(fileName, toDir);
|
|
@@ -914,17 +776,17 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
914
776
|
if (sourceFilePaths.length) {
|
|
915
777
|
sourceFiles = shortenPaths(
|
|
916
778
|
sourceFiles,
|
|
917
|
-
|
|
779
|
+
commonPathPrefix(sourceFilePaths)
|
|
918
780
|
);
|
|
919
781
|
}
|
|
782
|
+
|
|
920
783
|
data().each(function (doclet) {
|
|
921
|
-
|
|
784
|
+
let docletPath;
|
|
785
|
+
const url = helper.createLink(doclet);
|
|
922
786
|
|
|
923
787
|
helper.registerLink(doclet.longname, url);
|
|
924
788
|
|
|
925
789
|
// add a shortened version of the full path
|
|
926
|
-
var docletPath;
|
|
927
|
-
|
|
928
790
|
if (doclet.meta) {
|
|
929
791
|
docletPath = getPathFromDoclet(doclet);
|
|
930
792
|
docletPath = sourceFiles[docletPath].shortened;
|
|
@@ -935,7 +797,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
935
797
|
});
|
|
936
798
|
|
|
937
799
|
data().each(function (doclet) {
|
|
938
|
-
|
|
800
|
+
const url = helper.longnameToUrl[doclet.longname];
|
|
939
801
|
|
|
940
802
|
if (url.indexOf('#') > -1) {
|
|
941
803
|
doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
|
|
@@ -951,7 +813,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
951
813
|
});
|
|
952
814
|
|
|
953
815
|
// do this after the urls have all been generated
|
|
954
|
-
data().each(
|
|
816
|
+
data().each((doclet) => {
|
|
955
817
|
doclet.ancestors = getAncestorLinks(doclet);
|
|
956
818
|
|
|
957
819
|
if (doclet.kind === 'member') {
|
|
@@ -966,12 +828,11 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
966
828
|
}
|
|
967
829
|
});
|
|
968
830
|
|
|
969
|
-
|
|
970
|
-
|
|
831
|
+
members = helper.getMembers(data);
|
|
971
832
|
members.tutorials = tutorials.children;
|
|
972
833
|
|
|
973
834
|
// output pretty-printed source files by default
|
|
974
|
-
|
|
835
|
+
outputSourceFiles = Boolean(
|
|
975
836
|
conf.default && conf.default.outputSourceFiles !== false
|
|
976
837
|
);
|
|
977
838
|
|
|
@@ -982,37 +843,37 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
982
843
|
view.tutoriallink = tutoriallink;
|
|
983
844
|
view.htmlsafe = htmlsafe;
|
|
984
845
|
view.outputSourceFiles = outputSourceFiles;
|
|
985
|
-
view.footer = buildFooter();
|
|
986
|
-
view.displayModuleHeader = moduleHeader();
|
|
987
|
-
view.favicon = getFavicon();
|
|
988
|
-
view.dynamicStyle = createDynamicStyleSheet();
|
|
989
|
-
view.dynamicStyleSrc = returnPathOfStyleSrc();
|
|
990
|
-
view.dynamicScript = createDynamicsScripts();
|
|
991
|
-
view.dynamicScriptSrc = returnPathOfScriptScr();
|
|
992
|
-
view.includeScript = includeScript();
|
|
993
|
-
view.includeCss = includeCss();
|
|
994
|
-
view.meta = getMetaTagData();
|
|
995
|
-
view.theme = getTheme();
|
|
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);
|
|
996
857
|
// once for all
|
|
997
858
|
view.sidebar = buildSidebar(members);
|
|
998
|
-
view.navbar = buildNavbar();
|
|
999
|
-
view.resizeable = resizeable();
|
|
1000
|
-
view.codepen = codepen();
|
|
1001
|
-
view.baseURL = getBaseURL();
|
|
859
|
+
view.navbar = buildNavbar(themeOpts);
|
|
860
|
+
view.resizeable = resizeable(themeOpts);
|
|
861
|
+
view.codepen = codepen(themeOpts);
|
|
862
|
+
view.baseURL = getBaseURL(themeOpts);
|
|
1002
863
|
view.excludeInherited = Boolean(themeOpts.exclude_inherited);
|
|
1003
864
|
attachModuleSymbols(
|
|
1004
865
|
find({ longname: { left: 'module:' } }),
|
|
1005
866
|
members.modules
|
|
1006
867
|
);
|
|
1007
868
|
|
|
869
|
+
// added by clean-jsdoc-theme-devs
|
|
1008
870
|
// output search file if search
|
|
1009
|
-
|
|
1010
871
|
if (hasSearch) {
|
|
1011
872
|
fs.mkPath(path.join(outdir, 'data'));
|
|
1012
873
|
fs.writeFileSync(
|
|
1013
874
|
path.join(outdir, 'data', 'search.json'),
|
|
1014
875
|
JSON.stringify({
|
|
1015
|
-
list: searchListArray
|
|
876
|
+
list: searchListArray,
|
|
1016
877
|
})
|
|
1017
878
|
);
|
|
1018
879
|
}
|
|
@@ -1023,16 +884,16 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1023
884
|
}
|
|
1024
885
|
|
|
1025
886
|
if (members.globals.length) {
|
|
1026
|
-
generate('
|
|
887
|
+
generate('Global', [{ kind: 'globalobj' }], globalUrl);
|
|
1027
888
|
}
|
|
1028
889
|
|
|
1029
890
|
// index page displays information from package.json and lists files
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
891
|
+
files = find({ kind: 'file' });
|
|
892
|
+
packages = find({ kind: 'package' });
|
|
893
|
+
// added by clean-jsdoc-theme-devs
|
|
894
|
+
const homepageTitle = themeOpts.homepageTitle || 'Home';
|
|
1033
895
|
|
|
1034
896
|
generate(
|
|
1035
|
-
'',
|
|
1036
897
|
homepageTitle,
|
|
1037
898
|
packages
|
|
1038
899
|
.concat([
|
|
@@ -1041,83 +902,72 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1041
902
|
readme: opts.readme,
|
|
1042
903
|
longname: opts.mainpagetitle
|
|
1043
904
|
? opts.mainpagetitle
|
|
1044
|
-
: 'Main Page'
|
|
1045
|
-
}
|
|
905
|
+
: 'Main Page',
|
|
906
|
+
},
|
|
1046
907
|
])
|
|
1047
908
|
.concat(files),
|
|
1048
909
|
indexUrl
|
|
1049
910
|
);
|
|
1050
911
|
|
|
1051
912
|
// set up the lists that we'll use to generate pages
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
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);
|
|
1058
919
|
|
|
1059
920
|
Object.keys(helper.longnameToUrl).forEach(function (longname) {
|
|
1060
|
-
|
|
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 });
|
|
1061
927
|
|
|
1062
928
|
if (myModules.length) {
|
|
1063
929
|
generate(
|
|
1064
|
-
|
|
1065
|
-
myModules[0].name,
|
|
930
|
+
`Module: ${myModules[0].name}`,
|
|
1066
931
|
myModules,
|
|
1067
932
|
helper.longnameToUrl[longname]
|
|
1068
933
|
);
|
|
1069
934
|
}
|
|
1070
935
|
|
|
1071
|
-
var myClasses = helper.find(classes, { longname: longname });
|
|
1072
|
-
|
|
1073
936
|
if (myClasses.length) {
|
|
1074
937
|
generate(
|
|
1075
|
-
|
|
1076
|
-
myClasses[0].name,
|
|
938
|
+
`Class: ${myClasses[0].name}`,
|
|
1077
939
|
myClasses,
|
|
1078
940
|
helper.longnameToUrl[longname]
|
|
1079
941
|
);
|
|
1080
942
|
}
|
|
1081
943
|
|
|
1082
|
-
var myNamespaces = helper.find(namespaces, { longname: longname });
|
|
1083
|
-
|
|
1084
944
|
if (myNamespaces.length) {
|
|
1085
945
|
generate(
|
|
1086
|
-
|
|
1087
|
-
myNamespaces[0].name,
|
|
946
|
+
`Namespace: ${myNamespaces[0].name}`,
|
|
1088
947
|
myNamespaces,
|
|
1089
948
|
helper.longnameToUrl[longname]
|
|
1090
949
|
);
|
|
1091
950
|
}
|
|
1092
951
|
|
|
1093
|
-
var myMixins = helper.find(mixins, { longname: longname });
|
|
1094
|
-
|
|
1095
952
|
if (myMixins.length) {
|
|
1096
953
|
generate(
|
|
1097
|
-
|
|
1098
|
-
myMixins[0].name,
|
|
954
|
+
`Mixin: ${myMixins[0].name}`,
|
|
1099
955
|
myMixins,
|
|
1100
956
|
helper.longnameToUrl[longname]
|
|
1101
957
|
);
|
|
1102
958
|
}
|
|
1103
959
|
|
|
1104
|
-
var myExternals = helper.find(externals, { longname: longname });
|
|
1105
|
-
|
|
1106
960
|
if (myExternals.length) {
|
|
1107
961
|
generate(
|
|
1108
|
-
|
|
1109
|
-
myExternals[0].name,
|
|
962
|
+
`External: ${myExternals[0].name}`,
|
|
1110
963
|
myExternals,
|
|
1111
964
|
helper.longnameToUrl[longname]
|
|
1112
965
|
);
|
|
1113
966
|
}
|
|
1114
967
|
|
|
1115
|
-
var myInterfaces = helper.find(interfaces, { longname: longname });
|
|
1116
|
-
|
|
1117
968
|
if (myInterfaces.length) {
|
|
1118
969
|
generate(
|
|
1119
|
-
|
|
1120
|
-
myInterfaces[0].name,
|
|
970
|
+
`Interface: ${myInterfaces[0].name}`,
|
|
1121
971
|
myInterfaces,
|
|
1122
972
|
helper.longnameToUrl[longname]
|
|
1123
973
|
);
|
|
@@ -1126,15 +976,15 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1126
976
|
|
|
1127
977
|
// TODO: move the tutorial functions to templateHelper.js
|
|
1128
978
|
function generateTutorial(title, tutorial, filename) {
|
|
1129
|
-
|
|
979
|
+
const tutorialData = {
|
|
1130
980
|
title: title,
|
|
1131
981
|
header: tutorial.title,
|
|
1132
982
|
content: tutorial.parse(),
|
|
1133
|
-
children: tutorial.children
|
|
983
|
+
children: tutorial.children,
|
|
1134
984
|
};
|
|
1135
985
|
|
|
1136
|
-
|
|
1137
|
-
|
|
986
|
+
const tutorialPath = path.join(outdir, filename);
|
|
987
|
+
let html = view.render('tutorial.tmpl', tutorialData);
|
|
1138
988
|
|
|
1139
989
|
// yes, you can use {@link} in tutorials too!
|
|
1140
990
|
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
|
@@ -1147,10 +997,10 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
1147
997
|
}
|
|
1148
998
|
|
|
1149
999
|
// tutorials can have only one parent so there is no risk for loops
|
|
1150
|
-
function saveChildren(
|
|
1151
|
-
|
|
1000
|
+
function saveChildren({ children }) {
|
|
1001
|
+
children.forEach(function (child) {
|
|
1152
1002
|
generateTutorial(
|
|
1153
|
-
|
|
1003
|
+
`Tutorial: ${child.title}`,
|
|
1154
1004
|
child,
|
|
1155
1005
|
helper.tutorialToUrl(child.name)
|
|
1156
1006
|
);
|