Add custom file support to new docs

This commit is contained in:
Amish Shah
2016-08-22 17:03:36 +01:00
parent 601987ed01
commit be7ed4077a
5 changed files with 9 additions and 6 deletions

View File

@@ -6,9 +6,9 @@ const categories = {};
for (const file of files) { for (const file of files) {
file.category = file.category.toLowerCase(); file.category = file.category.toLowerCase();
if (!categories[file.category]) { if (!categories[file.category]) {
categories[file.category] = {}; categories[file.category] = [];
} }
categories[file.category][file.name] = file.data; categories[file.category].push(file);
} }
module.exports = categories; module.exports = categories;

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
{ {
"GEN_VERSION": 11, "GEN_VERSION": 12,
"COMPRESS": false "COMPRESS": false
} }

View File

@@ -8,10 +8,11 @@ const DocumentedEvent = require('./types/DocumentedEvent');
const GEN_VERSION = require('./config.json').GEN_VERSION; const GEN_VERSION = require('./config.json').GEN_VERSION;
class Documentation { class Documentation {
constructor(items) { constructor(items, custom) {
this.classes = new Map(); this.classes = new Map();
this.interfaces = new Map(); this.interfaces = new Map();
this.typedefs = new Map(); this.typedefs = new Map();
this.custom = custom;
this.parse(items); this.parse(items);
} }
@@ -104,6 +105,7 @@ class Documentation {
classes: Array.from(this.classes.values()).map(c => c.serialize()), classes: Array.from(this.classes.values()).map(c => c.serialize()),
interfaces: Array.from(this.interfaces.values()).map(i => i.serialize()), interfaces: Array.from(this.interfaces.values()).map(i => i.serialize()),
typedefs: Array.from(this.typedefs.values()).map(t => t.serialize()), typedefs: Array.from(this.typedefs.values()).map(t => t.serialize()),
custom: this.custom,
}; };
return serialized; return serialized;
} }

View File

@@ -5,12 +5,13 @@ const DocumentationScanner = require('./doc-scanner');
const Documentation = require('./documentation'); const Documentation = require('./documentation');
const fs = require('fs-extra'); const fs = require('fs-extra');
const zlib = require('zlib'); const zlib = require('zlib');
const custom = require('../custom/index');
const docScanner = new DocumentationScanner(this); const docScanner = new DocumentationScanner(this);
function parseDocs(json) { function parseDocs(json) {
console.log(`${json.length} items found`); console.log(`${json.length} items found`);
const documentation = new Documentation(json); const documentation = new Documentation(json, custom);
console.log('serializing'); console.log('serializing');
let output = JSON.stringify(documentation.serialize(), null, 0); let output = JSON.stringify(documentation.serialize(), null, 0);
if (compress) { if (compress) {