clean-jsdoc-theme 4.2.13 → 4.2.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # clean-jsdoc-theme
2
2
 
3
- [![Stars](https://img.shields.io/github/stars/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-4.2.13-005bff) [![Issues Open](https://img.shields.io/github/issues/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [![Build Status](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme.svg?branch=production)](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
3
+ [![Stars](https://img.shields.io/github/stars/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-4.2.15-005bff) [![Issues Open](https://img.shields.io/github/issues/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [![Build Status](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme.svg?branch=production)](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
4
4
  <br>
5
5
 
6
6
  `clean-jsdoc-theme` is a beautifully crafted theme for JSDoc 3/JSDoc 4. It is a clean and fully responsive theme with loads of
@@ -480,6 +480,34 @@ Assuming the above js file is stored in `./static/showAlert.js`. To include you
480
480
  It will include the js files to the output dir and also attach a script tag to the html pointing to the included js
481
481
  file.
482
482
 
483
+ If you want to add some script for some pages then you can do the following:
484
+
485
+ ```json
486
+ "include_js": [
487
+ "./demo/src/assets/script.js",
488
+ {
489
+ "filepath": "./demo/src/assets/random.js",
490
+ "targets": [
491
+ "MyClass",
492
+ "tutorial-MyClassTutorial"
493
+ ]
494
+ }
495
+ ],
496
+ ```
497
+
498
+ Here target is the name of the generated html file (don't include `.html`).
499
+
500
+ The above config will add `./demo/src/assets/script.js` to all the generated html files. However, it will
501
+ add `./demo/src/assets/random.js` only to `MyClass.html` and `tutorial-MyClassTutorial.html` files.
502
+
503
+ The file name of the generated html generally follows the following convention:
504
+
505
+ - Class: class's name + `.html`. Ex `Alive.html`
506
+ - Module: `module-` + module's name + `.html`. Ex: `module-SqlJs.html`
507
+ - Tutorials: `tutorial-` + tutorial's filename + `.html`
508
+
509
+ If you are not sure about the target name, then generate html for the first time, then look at the urls.
510
+
483
511
  ### To ignore sorting
484
512
 
485
513
  To ignore the sorting of members/methods/event in the page. If it is `false` then the order of
@@ -1,7 +1,7 @@
1
1
  const has = require('lodash/has');
2
2
  const klawSync = require('klaw-sync');
3
- const path = require('path')
4
- const fse = require('fs-extra')
3
+ const path = require('path');
4
+ const fse = require('fs-extra');
5
5
  const showdown = require('showdown');
6
6
 
7
7
  const mdToHTMLConverter = new showdown.Converter();
@@ -16,7 +16,7 @@ function lsSync(dir, opts = {}) {
16
16
  });
17
17
 
18
18
  return files.map((f) => f.path);
19
- };
19
+ }
20
20
 
21
21
  function copyToOutputFolder(filePath, outdir) {
22
22
  const resolvedPath = path.resolve(filePath);
@@ -31,8 +31,15 @@ function copyToOutputFolderFromArray(filePathArray, outdir) {
31
31
 
32
32
  if (Array.isArray(filePathArray)) {
33
33
  for (const filePath of filePathArray) {
34
- copyToOutputFolder(filePath, outdir);
35
- outputList.push(path.basename(filePath));
34
+ if (typeof filePath === 'string') {
35
+ copyToOutputFolder(filePath, outdir);
36
+ outputList.push(path.basename(filePath));
37
+ } else if (typeof filePath === 'object') {
38
+ const { filepath, targets } = filePath;
39
+
40
+ copyToOutputFolder(filepath, outdir);
41
+ outputList.push({ filepath: path.basename(filepath), targets });
42
+ }
36
43
  }
37
44
  }
38
45
 
@@ -158,8 +165,6 @@ function getProcessedYield(yields) {
158
165
  }));
159
166
  }
160
167
 
161
-
162
-
163
168
  module.exports = {
164
169
  buildFooter,
165
170
  moduleHeader,
@@ -177,5 +182,5 @@ module.exports = {
177
182
  returnPathOfStyleSrc,
178
183
  copyStaticFolder,
179
184
  getProcessedYield,
180
- lsSync
181
- }
185
+ lsSync,
186
+ };
package/jsdoc-config.json CHANGED
@@ -3,9 +3,14 @@
3
3
  "allowUnknownTags": true
4
4
  },
5
5
  "source": {
6
- "include": ["./demo/src", "./README.md"]
6
+ "include": [
7
+ "./demo/src",
8
+ "./README.md"
9
+ ]
7
10
  },
8
- "plugins": ["plugins/markdown"],
11
+ "plugins": [
12
+ "plugins/markdown"
13
+ ],
9
14
  "opts": {
10
15
  "encoding": "utf8",
11
16
  "destination": "output/v4",
@@ -18,9 +23,28 @@
18
23
  "homepageTitle": "Clean JSDoc Theme",
19
24
  "default_theme": "dark",
20
25
  "exclude_inherited": false,
21
- "include_css": ["./demo/src/assets/style.css"],
22
- "include_js": ["./demo/src/assets/script.js"],
23
- "static_dir": ["./demo/src/assets/png", "./example"],
26
+ "include_css": [
27
+ {
28
+ "filepath": "./demo/src/assets/style.css",
29
+ "targets": [
30
+ "AgentArray"
31
+ ]
32
+ }
33
+ ],
34
+ "include_js": [
35
+ "./demo/src/assets/script.js",
36
+ {
37
+ "filepath": "./demo/src/assets/agentarray.js",
38
+ "targets": [
39
+ "AgentArray",
40
+ "tutorial-AgentArray_"
41
+ ]
42
+ }
43
+ ],
44
+ "static_dir": [
45
+ "./demo/src/assets/png",
46
+ "./example"
47
+ ],
24
48
  "add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')} bar(); foo();",
25
49
  "create_style": ".test-create-style{ background: red}",
26
50
  "displayModuleHeader": true,
@@ -49,10 +73,13 @@
49
73
  }
50
74
  ],
51
75
  "codepen": {
52
- "enable_for": ["examples"],
76
+ "enable_for": [
77
+ "examples"
78
+ ],
53
79
  "options": {
54
80
  "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
55
- "js_pre_processor": "babel"
81
+ "js_pre_processor": "babel",
82
+ "js": "import {AgentArray} from 'https://unpkg.com/agentscript@0.10.19/dist/agentscript.js'"
56
83
  }
57
84
  },
58
85
  "prefixModuleToSidebarItems_experimental": true
@@ -61,7 +88,9 @@
61
88
  "templates": {
62
89
  "default": {
63
90
  "staticFiles": {
64
- "include": ["./example"]
91
+ "include": [
92
+ "./example"
93
+ ]
65
94
  }
66
95
  }
67
96
  },
@@ -69,4 +98,4 @@
69
98
  "hardwrap": false,
70
99
  "idInHeadings": true
71
100
  }
72
- }
101
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clean-jsdoc-theme",
3
- "version": "4.2.13",
3
+ "version": "4.2.15",
4
4
  "description": "A beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template. This is a fully mobile responsive theme and also fully customizable theme.",
5
5
  "main": "publish.js",
6
6
  "scripts": {
package/publish.js CHANGED
@@ -325,6 +325,7 @@ async function generate(title, docs, filename, resolveLinks) {
325
325
  env: env,
326
326
  title: title,
327
327
  docs: docs,
328
+ filename,
328
329
  };
329
330
 
330
331
  outpath = path.join(outdir, filename);
@@ -1016,6 +1017,7 @@ exports.publish = async function (taffyData, opts, tutorials) {
1016
1017
  header: tutorial.title,
1017
1018
  content: tutorial.parse(),
1018
1019
  children: tutorial.children,
1020
+ filename,
1019
1021
  };
1020
1022
 
1021
1023
  const tutorialPath = path.join(outdir, filename);
@@ -91,7 +91,8 @@
91
91
  <?js } ?>
92
92
 
93
93
  <?js
94
- var classes = self.find({kind: 'class', memberof: doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}}) } );
94
+ var shouldExcludeInherited = { ...(self.excludeInherited ? { inherited: {isUndefined: true} } : {}) };
95
+ var classes = self.find({kind: 'class', memberof: doc.longname, ...shouldExcludeInherited } );
95
96
  if (!isGlobalPage && classes && classes.length) {
96
97
  ?>
97
98
  <h2 id="classes" class="subsection-title has-anchor">Classes</h2>
@@ -103,7 +104,7 @@
103
104
  <?js } ?>
104
105
 
105
106
  <?js
106
- var interfaces = self.find({kind: 'interface', memberof: doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
107
+ var interfaces = self.find({kind: 'interface', memberof: doc.longname, ...shouldExcludeInherited});
107
108
  if (!isGlobalPage && interfaces && interfaces.length) {
108
109
  ?>
109
110
  <h2 id="interfaces" class="subsection-title has-anchor">Interfaces</h2>
@@ -115,7 +116,7 @@
115
116
  <?js } ?>
116
117
 
117
118
  <?js
118
- var mixins = self.find({kind: 'mixin', memberof: doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
119
+ var mixins = self.find({kind: 'mixin', memberof: doc.longname, ...shouldExcludeInherited});
119
120
  if (!isGlobalPage && mixins && mixins.length) {
120
121
  ?>
121
122
  <h2 id="mixins" class="subsection-title has-anchor">Mixins</h2>
@@ -127,7 +128,7 @@
127
128
  <?js } ?>
128
129
 
129
130
  <?js
130
- var namespaces = self.find({kind: 'namespace', memberof: doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
131
+ var namespaces = self.find({kind: 'namespace', memberof: doc.longname, ...shouldExcludeInherited});
131
132
  if (!isGlobalPage && namespaces && namespaces.length) {
132
133
  ?>
133
134
  <h2 id="namespaces" class="subsection-title has-anchor">Namespaces</h2>
@@ -139,7 +140,7 @@
139
140
  <?js } ?>
140
141
 
141
142
  <?js
142
- var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
143
+ var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...shouldExcludeInherited});
143
144
 
144
145
  // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
145
146
  if (isGlobalPage && members && members.length && members.forEach) {
@@ -157,7 +158,7 @@
157
158
  <?js } ?>
158
159
 
159
160
  <?js
160
- var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
161
+ var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...shouldExcludeInherited});
161
162
  if (methods && methods.length && methods.forEach) {
162
163
  ?>
163
164
  <h2 id="methods" class="subsection-title has-anchor">Methods</h2>
@@ -168,7 +169,7 @@
168
169
  <?js } ?>
169
170
 
170
171
  <?js
171
- var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
172
+ var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...shouldExcludeInherited});
172
173
  if (typedefs && typedefs.length && typedefs.forEach) {
173
174
  ?>
174
175
  <h2 id="type-definitions" class="subsection-title has-anchor">Type Definitions</h2>
@@ -188,7 +189,7 @@
188
189
  <?js } ?>
189
190
 
190
191
  <?js
191
- var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...(self.excludeInherited && {inherited: {'!is': self.excludeInherited}})});
192
+ var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...shouldExcludeInherited});
192
193
  if (events && events.length && events.forEach) {
193
194
  ?>
194
195
  <h2 id="events" class="subsection-title has-anchor">Events</h2>
@@ -203,3 +204,5 @@
203
204
  <?js } ?>
204
205
 
205
206
  <?js }); ?>
207
+
208
+ <?js= self.partial('include-target-script-and-styles.tmpl', arguments[0].filename) ?>
@@ -0,0 +1,39 @@
1
+ <?js
2
+
3
+ const filename = obj.replace('.html', '')
4
+ const scripts = []
5
+ const styles = []
6
+
7
+
8
+ for (const script of this.includeScript) {
9
+ if(typeof script === 'object') {
10
+ for (const target of script.targets) {
11
+ if(filename === target) {
12
+ scripts.push(script.filepath)
13
+ }
14
+ }
15
+ }
16
+ }
17
+
18
+ for (const style of this.includeCss) {
19
+ if(typeof style === 'object') {
20
+ for (const target of style.targets) {
21
+ if(filename === target) {
22
+ styles.push(style.filepath)
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+
29
+ ?>
30
+
31
+ <?js scripts.forEach(function(source){ ?>
32
+ <script src="<?js= source ?>"></script>
33
+ <?js }) ?>
34
+
35
+ <?js styles.forEach(function(source){ ?>
36
+ <script>
37
+ document.head.innerHTML += '<link type="text/css" rel="stylesheet" href="<?js= source ?>">'
38
+ </script>
39
+ <?js }) ?>
package/tmpl/layout.tmpl CHANGED
@@ -34,14 +34,18 @@
34
34
  <!-- Adding scripts-->
35
35
  <?js if(this.includeScript != undefined) { ?>
36
36
  <?js this.includeScript.forEach(function(source){ ?>
37
- <script src="<?js= source ?>"></script>
37
+ <?js if(typeof source === 'string') { ?>
38
+ <script src="<?js= source ?>"></script>
39
+ <?js } ?>
38
40
  <?js }) ?>
39
41
  <?js } ?>
40
42
 
41
43
  <!-- Adding style-->
42
44
  <?js if(this.includeCss != undefined) { ?>
43
45
  <?js this.includeCss.forEach(function(source){ ?>
44
- <link type="text/css" rel="stylesheet" href="<?js= source ?>">
46
+ <?js if(typeof source === 'string') { ?>
47
+ <link type="text/css" rel="stylesheet" href="<?js= source ?>">
48
+ <?js } ?>
45
49
  <?js }) ?>
46
50
  <?js } ?>
47
51
 
@@ -17,3 +17,8 @@
17
17
  </article>
18
18
 
19
19
  </section>
20
+
21
+
22
+ <?js console.log('Children', filename) ?>
23
+ <?js= this.partial('include-target-script-and-styles.tmpl', filename) ?>
24
+