Browse Source

Update Options handlbar scheme (#2397)

Guy Carmeli 6 years ago
parent
commit
fb1f68a6bb
No account linked to committer's email address

+ 1
- 2
docs/docs/options/BottomTabs.md View File

@@ -1,6 +1,5 @@
1
-<a name="BottomTabs"></a>
1
+<h1>BottomTabs</h1>
2 2
 
3
-## BottomTabs
4 3
 **Properties**
5 4
 
6 5
 | Name | Type |

+ 1
- 2
docs/docs/options/Button.md View File

@@ -1,6 +1,5 @@
1
-<a name="Button"></a>
1
+<h1>Button</h1>
2 2
 
3
-## Button
4 3
 **Properties**
5 4
 
6 5
 | Name | Type |

+ 1
- 2
docs/docs/options/NavigationOptions.md View File

@@ -1,6 +1,5 @@
1
-<a name="NavigationOptions"></a>
1
+<h1>NavigationOptions</h1>
2 2
 
3
-## NavigationOptions
4 3
 **Properties**
5 4
 
6 5
 | Name | Type |

+ 1
- 2
docs/docs/options/TopBar.md View File

@@ -1,6 +1,5 @@
1
-<a name="TopBar"></a>
1
+<h1>TopBar</h1>
2 2
 
3
-## TopBar
4 3
 **Properties**
5 4
 
6 5
 | Name | Type |

+ 3
- 0
docs/templates/header.hbs View File

@@ -0,0 +1,3 @@
1
+<h1>{{anchorName}}</h1>
2
+
3
+{{>sig-name}}

+ 14
- 0
docs/templates/sig-name.hbs View File

@@ -0,0 +1,14 @@
1
+{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}
2
+{{#if name}}{{#sig~}}
3
+{{{@depOpen}~}}
4
+{{{@codeOpen}~}}
5
+{{#if @prefix}}{{@prefix}} {{/if~}}
6
+{{@parent~}}
7
+{{#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}
8
+{{{@codeClose}~}}
9
+{{#if @returnSymbol}} {{@returnSymbol}}{{/if~}}
10
+{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \| " }}{{/if~}}
11
+{{#if @suffix}} {{@suffix}}{{/if~}}
12
+{{{@depClose}~}}
13
+{{~/sig}}{{/if~}}
14
+{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}

+ 16
- 14
scripts/generate-js-doc.js View File

@@ -2,15 +2,16 @@ const jsdoc2md = require('jsdoc-to-markdown');
2 2
 const fs = require('fs');
3 3
 const path = require('path');
4 4
 
5
-const paramsDir = './lib/src/params/';
6
-const optionsDir = './lib/src/params/options/';
5
+const PARAMS_DIR = './lib/src/params/';
6
+const OPTIONS_DIR = './lib/src/params/options/';
7 7
 const OUTPUT_DIR = './docs/docs/';
8
-const partial = ['./docs/templates/scope.hbs', './docs/templates/docs.hbs'];
8
+const OPTION_PARTIALS = ['./docs/templates/header.hbs', './docs/templates/sig-name.hbs'];
9
+const PARTIALS = ['./docs/templates/scope.hbs', './docs/templates/docs.hbs'];
9 10
 
10
-const generateMarkdownForFile = ({ file, outputDir }) => {
11
+const generateMarkdownForFile = ({ file, outputDir, partial }) => {
11 12
   const templateData = jsdoc2md.getTemplateDataSync({ files: file });
12 13
   const classNames = getClassesInFile(templateData);
13
-  classNames.forEach((className) => createDocFileForClass(className, templateData, outputDir));
14
+  classNames.forEach((className) => createDocFileForClass({ className, templateData, outputDir, partial }));
14 15
 };
15 16
 
16 17
 function getClassesInFile(templateData) {
@@ -23,15 +24,15 @@ function getClassesInFile(templateData) {
23 24
   return classNames;
24 25
 }
25 26
 
26
-function createDocFileForClass(className, templateData, outputDir) {
27
+function createDocFileForClass({ className, templateData, outputDir, partial = [] }) {
27 28
   const template = `{{#class name="${className}"}}{{>docs}}{{/class}}`;
28 29
   const options = {
29 30
     data: templateData,
30 31
     template,
31 32
     separators: true,
32
-    partial
33
+    partial: [...PARTIALS, ...partial]
33 34
   };
34
-  console.log(`rendering ${className}, template: ${template} ${outputDir}`);
35
+  console.log(`rendering ${className}`);
35 36
   const output = jsdoc2md.renderSync(options);
36 37
   fs.writeFileSync(path.resolve(outputDir, `${className}.md`), output);
37 38
 }
@@ -39,17 +40,18 @@ function createDocFileForClass(className, templateData, outputDir) {
39 40
 function inputFiles() {
40 41
   return [
41 42
     { file: './lib/src/Navigation.js', outputDir: OUTPUT_DIR },
42
-    ...fs.readdirSync(optionsDir).map((file) => {
43
+    ...fs.readdirSync(OPTIONS_DIR).map((file) => {
43 44
       return {
44
-        file: optionsDir + file,
45
-        outputDir: OUTPUT_DIR + 'options/'
45
+        file: OPTIONS_DIR + file,
46
+        outputDir: OUTPUT_DIR + 'options/',
47
+        partial: OPTION_PARTIALS
46 48
       };
47 49
     }),
48
-    ...fs.readdirSync(paramsDir)
49
-        .filter((file) => fs.statSync(paramsDir + file).isFile())
50
+    ...fs.readdirSync(PARAMS_DIR)
51
+        .filter((file) => fs.statSync(PARAMS_DIR + file).isFile())
50 52
         .map((file) => {
51 53
           return {
52
-            file: paramsDir + file,
54
+            file: PARAMS_DIR + file,
53 55
             outputDir: OUTPUT_DIR
54 56
           };
55 57
         })