zero-ai 0.3.25
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/CNAME +1 -0
- package/README.md +54 -0
- package/SUMMARY.md +15 -0
- package/_config.yml +1 -0
- package/_layouts/default.html +60 -0
- package/_sass/jekyll-theme-dinky.scss +440 -0
- package/_sass/rouge-github.scss +209 -0
- package/assets/css/style.scss +4 -0
- package/assets/images/arrow-down.png +0 -0
- package/assets/images/octocat-small.png +0 -0
- package/assets/js/scale.fix.js +20 -0
- package/configs/sorts.json +38 -0
- package/document/doc-config/jsdoc.json +89 -0
- package/document/doc-config/third-part/esdoc.json +9 -0
- package/document/doc-config/third-part/yuidoc-example.json +23 -0
- package/document/doc-config/third-part/yuidoc.json +11 -0
- package/document/doc-config/tpl/publish.js +778 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/document/doc-config/tpl/static/scripts/collapse.js +20 -0
- package/document/doc-config/tpl/static/scripts/linenumber.js +25 -0
- package/document/doc-config/tpl/static/scripts/nav.js +12 -0
- package/document/doc-config/tpl/static/scripts/polyfill.js +4 -0
- package/document/doc-config/tpl/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/document/doc-config/tpl/static/scripts/prettify/lang-css.js +2 -0
- package/document/doc-config/tpl/static/scripts/prettify/prettify.js +28 -0
- package/document/doc-config/tpl/static/scripts/search.js +83 -0
- package/document/doc-config/tpl/static/styles/jsdoc.css +765 -0
- package/document/doc-config/tpl/static/styles/prettify.css +79 -0
- package/document/doc-config/tpl/static/styles/zero.css +50 -0
- package/document/doc-config/tpl/tmpl/augments.tmpl +10 -0
- package/document/doc-config/tpl/tmpl/container.tmpl +197 -0
- package/document/doc-config/tpl/tmpl/details.tmpl +148 -0
- package/document/doc-config/tpl/tmpl/example.tmpl +2 -0
- package/document/doc-config/tpl/tmpl/examples.tmpl +13 -0
- package/document/doc-config/tpl/tmpl/exceptions.tmpl +32 -0
- package/document/doc-config/tpl/tmpl/layout.tmpl +98 -0
- package/document/doc-config/tpl/tmpl/mainpage.tmpl +15 -0
- package/document/doc-config/tpl/tmpl/members.tmpl +38 -0
- package/document/doc-config/tpl/tmpl/method.tmpl +138 -0
- package/document/doc-config/tpl/tmpl/modifies.tmpl +14 -0
- package/document/doc-config/tpl/tmpl/params.tmpl +132 -0
- package/document/doc-config/tpl/tmpl/properties.tmpl +107 -0
- package/document/doc-config/tpl/tmpl/returns.tmpl +19 -0
- package/document/doc-config/tpl/tmpl/source.tmpl +8 -0
- package/document/doc-config/tpl/tmpl/tutorial.tmpl +19 -0
- package/document/doc-config/tpl/tmpl/type.tmpl +7 -0
- package/document/doc-config/tpl/zero.css +0 -0
- package/document/doc-web/E.html +395 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/document/doc-web/index.html +262 -0
- package/document/doc-web/module-_debug.html +1104 -0
- package/document/doc-web/module-_epic.html +1631 -0
- package/document/doc-web/module-ai.html +1701 -0
- package/document/doc-web/module-aj.html +1081 -0
- package/document/doc-web/scripts/collapse.js +20 -0
- package/document/doc-web/scripts/linenumber.js +25 -0
- package/document/doc-web/scripts/nav.js +12 -0
- package/document/doc-web/scripts/polyfill.js +4 -0
- package/document/doc-web/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/document/doc-web/scripts/prettify/lang-css.js +2 -0
- package/document/doc-web/scripts/prettify/prettify.js +28 -0
- package/document/doc-web/scripts/search.js +83 -0
- package/document/doc-web/styles/jsdoc.css +765 -0
- package/document/doc-web/styles/prettify.css +79 -0
- package/document/doc-web/styles/zero.css +50 -0
- package/document/markdown/README.md +0 -0
- package/document/markdown/gong-cheng-chu-shi-hua.md +79 -0
- package/document/markdown/t0002-uuidsheng-cheng-qi.md +142 -0
- package/document/markdown/t0003-shu-ju-mo-ni-qi.md +135 -0
- package/document/markdown/t0004-zerode-fu-wu-tong-xun-fen-xi-qi.md +64 -0
- package/document/markdown/t0005-liquibaseshu-ju-zhuan-huan-qi.md +68 -0
- package/document/markdown/zt0001-pagecardchuang-jian.md +71 -0
- package/document/markdown/zt0002-formchuang-jian.md +81 -0
- package/document/markdown/zt0003-tian-jia-card-an-niu.md +115 -0
- package/document/markdown/zt0004-chu-li-modal-zhe-zhao-xiao-guo.md +105 -0
- package/document/markdown/ztgong-ju.md +0 -0
- package/install-local.sh +3 -0
- package/package.json +53 -0
- package/run-authorize.sh +32 -0
- package/run-doc.sh +16 -0
- package/run-update.sh +6 -0
- package/script/bootstrap +6 -0
- package/script/cibuild +9 -0
- package/script/release +42 -0
- package/script/validate-html +28 -0
- package/script/zrun-doc-generate.sh +18 -0
- package/script/zrun-doc-server.sh +13 -0
- package/src/ai.js +11 -0
- package/src/aj.js +11 -0
- package/src/art.js +11 -0
- package/src/cab/form/UI.js.tpl +50 -0
- package/src/cab/form/UI.json.tpl +38 -0
- package/src/cab/list/Op.js.tpl +42 -0
- package/src/cab/list/UI.Add.json.tpl +32 -0
- package/src/cab/list/UI.Edit.json.tpl +34 -0
- package/src/cab/list/UI.Filter.json.tpl +29 -0
- package/src/cab/list/UI.Form.js.tpl +64 -0
- package/src/cab/list/UI.js.tpl +49 -0
- package/src/cab/list/UI.json.tpl +208 -0
- package/src/cab/perm/falcon.app.xlsx +0 -0
- package/src/cab/perm/falcon.authority.resource.perm.xlsx +0 -0
- package/src/cab/perm/falcon.authority.resource.resource.xlsx +0 -0
- package/src/cab/perm/falcon.authority.role.action.xlsx +0 -0
- package/src/cab/perm/falcon.authority.view.xlsx +0 -0
- package/src/cab/perm/falcon.battery.module.xlsx +0 -0
- package/src/cab/perm/falcon.epic.form.xlsx +0 -0
- package/src/cab/perm/falcon.epic.integration.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.entity.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.field.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.global.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.model.xlsx +0 -0
- package/src/cab/perm/falcon.epic.page.xlsx +0 -0
- package/src/cab/perm/falcon.epic.topology.xlsx +0 -0
- package/src/cab/perm/falcon.fm.bank.xlsx +0 -0
- package/src/cab/perm/falcon.fm.bill.process.xlsx +0 -0
- package/src/cab/perm/falcon.fm.book.xlsx +0 -0
- package/src/cab/perm/falcon.fm.currency.xlsx +0 -0
- package/src/cab/perm/falcon.fm.debt.xlsx +0 -0
- package/src/cab/perm/falcon.fm.settlement.xlsx +0 -0
- package/src/cab/perm/falcon.fm.subject.xlsx +0 -0
- package/src/cab/perm/falcon.fm.term.xlsx +0 -0
- package/src/cab/perm/falcon.i.directory.xlsx +0 -0
- package/src/cab/perm/falcon.i.integration.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.city.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.floor.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.query.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.state.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.tent.xlsx +0 -0
- package/src/cab/perm/falcon.login.index.xlsx +0 -0
- package/src/cab/perm/falcon.my.menu.xlsx +0 -0
- package/src/cab/perm/falcon.organization.brand.xlsx +0 -0
- package/src/cab/perm/falcon.organization.company.xlsx +0 -0
- package/src/cab/perm/falcon.organization.contract.xlsx +0 -0
- package/src/cab/perm/falcon.organization.customer.xlsx +0 -0
- package/src/cab/perm/falcon.organization.dept.team.xlsx +0 -0
- package/src/cab/perm/falcon.organization.dept.xlsx +0 -0
- package/src/cab/perm/falcon.organization.employee.identity.xlsx +0 -0
- package/src/cab/perm/falcon.organization.employee.xlsx +0 -0
- package/src/cab/perm/falcon.organization.project.xlsx +0 -0
- package/src/cab/perm/falcon.psi.pos.xlsx +0 -0
- package/src/cab/perm/falcon.psi.wh.xlsx +0 -0
- package/src/cab/perm/falcon.rbac.group.xlsx +0 -0
- package/src/cab/perm/falcon.rbac.role.xlsx +0 -0
- package/src/cab/perm/falcon.rbac.user.xlsx +0 -0
- package/src/cab/perm/falcon.system.document.xlsx +0 -0
- package/src/cab/perm/falcon.system.job.xlsx +0 -0
- package/src/cab/perm/falcon.system.report.xlsx +0 -0
- package/src/cab/perm/falcon.system.sync_log.xlsx +0 -0
- package/src/cab/perm/falcon.system.todo.xlsx +0 -0
- package/src/cab/perm/falcon.system.workflow.xlsx +0 -0
- package/src/cab/perm/falcon.ui.app.xlsx +0 -0
- package/src/cab/perm/falcon.view.personal.xlsx +0 -0
- package/src/cab/perm/falcon.x.activity.xlsx +0 -0
- package/src/cab/perm/falcon.x.attachment.xlsx +0 -0
- package/src/cab/perm/falcon.x.category.xlsx +0 -0
- package/src/cab/perm/falcon.x.integration.xlsx +0 -0
- package/src/cab/perm/falcon.x.linkage.xlsx +0 -0
- package/src/cab/perm/falcon.x.menu.xlsx +0 -0
- package/src/cab/perm/falcon.x.notice.xlsx +0 -0
- package/src/cab/perm/falcon.x.tabular.xlsx +0 -0
- package/src/cab/perm/falcon.x.tag.xlsx +0 -0
- package/src/cab/plugin/Component.java.tpl +52 -0
- package/src/cab/plugin/Cv.java.tpl +21 -0
- package/src/cab/plugin/ErrorIo.java.tpl +26 -0
- package/src/cab/plugin/In.Abstract.java.tpl +30 -0
- package/src/cab/plugin/In.java.tpl +25 -0
- package/src/cab/plugin/Io.Abstract.java.tpl +36 -0
- package/src/cab/plugin/Io.Impl.java.tpl +21 -0
- package/src/cab/plugin/Io.java.tpl +73 -0
- package/src/cab/plugin/Plugin.After.java.tpl +22 -0
- package/src/cab/plugin/Plugin.Before.java.tpl +22 -0
- package/src/cab/plugin/Refine.Log.java.tpl +47 -0
- package/src/cab/plugin/Refine.Pin.java.tpl +70 -0
- package/src/cab/plugin/Refine.java.tpl +67 -0
- package/src/cab/plugin/configuration.json.tpl +3 -0
- package/src/cab/plugin/infix.xml.tpl +22 -0
- package/src/cab/plugin/integration.json.tpl +20 -0
- package/src/cab/resource/falcon.resource.xlsx +0 -0
- package/src/cab/resource/resource.json +8 -0
- package/src/cab/resource/resource.xlsx +0 -0
- package/src/commander/ai.zero +10 -0
- package/src/commander/aj.zero +8 -0
- package/src/commander/ar.zero +4 -0
- package/src/commander/option.zero +21 -0
- package/src/commander-ai/fn.csv.js +105 -0
- package/src/commander-ai/fn.data.js +404 -0
- package/src/commander-ai/fn.init.js +106 -0
- package/src/commander-ai/fn.key.js +81 -0
- package/src/commander-ai/fn.md5.js +76 -0
- package/src/commander-ai/fn.random.js +84 -0
- package/src/commander-ai/fn.uk.js +70 -0
- package/src/commander-ai/fn.uuid.js +80 -0
- package/src/commander-ai/index.js +19 -0
- package/src/commander-aj/bundle/specification.txt +49 -0
- package/src/commander-aj/fn.i.mod.js +26 -0
- package/src/commander-aj/fn.i.resource.js +33 -0
- package/src/commander-aj/fn.j.bundle.js +51 -0
- package/src/commander-aj/fn.j.init.js +72 -0
- package/src/commander-aj/fn.j.permission.js +60 -0
- package/src/commander-aj/fn.j.plugin.js +120 -0
- package/src/commander-aj/fn.j.row.js +5 -0
- package/src/commander-aj/index.js +16 -0
- package/src/commander-ar/fn.i.complex.js +112 -0
- package/src/commander-ar/fn.i.form.js +91 -0
- package/src/commander-ar/index.js +7 -0
- package/src/epic/ai.economy.impl.fn.excel.js +128 -0
- package/src/epic/ai.economy.impl.fn.execute.js +162 -0
- package/src/epic/ai.economy.impl.fn.java.js +140 -0
- package/src/epic/ai.economy.impl.fn.json.js +23 -0
- package/src/epic/ai.economy.impl.fn.plugin.js +160 -0
- package/src/epic/ai.economy.impl.fn.react.js +219 -0
- package/src/epic/ai.export.impl.fn.parse.js +345 -0
- package/src/epic/ai.export.impl.fn.seek.js +42 -0
- package/src/epic/ai.export.interface.fn.string.js +5 -0
- package/src/epic/ai.export.interface.io.js +69 -0
- package/src/epic/ai.export.interface.util.js +17 -0
- package/src/epic/ai.path.fn.dir.operation.js +87 -0
- package/src/epic/ai.path.fn.io.command.js +43 -0
- package/src/epic/ai.path.fn.io.specification.js +59 -0
- package/src/epic/ai.path.fn.io.typed.js +63 -0
- package/src/epic/ai.path.fn.out.content.js +47 -0
- package/src/epic/ai.string.fn.str.util.js +56 -0
- package/src/epic/ai.uncork.fn.element.feature.js +52 -0
- package/src/epic/ai.uncork.fn.it.feature.js +118 -0
- package/src/epic/ai.uncork.fn.to.typed.js +74 -0
- package/src/epic/ai.under.fn.cx.evaluate.js +81 -0
- package/src/epic/ai.under.fn.fx.terminal.js +143 -0
- package/src/epic/ai.unified.fn._.logging.js +45 -0
- package/src/epic/ai.unified.fn.fn.error.code.js +114 -0
- package/src/epic/ai.unified.fn.is.decision.js +20 -0
- package/src/epic/ai.unified.fn.sorter.element.js +26 -0
- package/src/epic/index.js +216 -0
- package/src/epic/zero.__.fn.find.util.js +37 -0
- package/src/epic/zero.__.v.constant.js +5 -0
- package/test/csv.json +12 -0
- package/test/csv.zero +2 -0
- package/test/data.zero +56 -0
- package/test/key/key1.json +15 -0
- package/test/key/key2.json +12 -0
- package/test/key/key3.json +5 -0
- package/test/key.json +12 -0
- package/test/uk.json +19 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
/*global env: true */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var doop = require('jsdoc/util/doop');
|
|
5
|
+
var fs = require('jsdoc/fs');
|
|
6
|
+
var helper = require('jsdoc/util/templateHelper');
|
|
7
|
+
var logger = require('jsdoc/util/logger');
|
|
8
|
+
var path = require('jsdoc/path');
|
|
9
|
+
var taffy = require('taffydb').taffy;
|
|
10
|
+
var template = require('jsdoc/template');
|
|
11
|
+
var util = require('util');
|
|
12
|
+
|
|
13
|
+
var htmlsafe = helper.htmlsafe;
|
|
14
|
+
var linkto = helper.linkto;
|
|
15
|
+
var resolveAuthorLinks = helper.resolveAuthorLinks;
|
|
16
|
+
var scopeToPunc = helper.scopeToPunc;
|
|
17
|
+
var hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
|
|
19
|
+
var data;
|
|
20
|
+
var view;
|
|
21
|
+
|
|
22
|
+
var outdir = path.normalize(env.opts.destination);
|
|
23
|
+
|
|
24
|
+
function copyFile(source, target, cb) {
|
|
25
|
+
var cbCalled = false;
|
|
26
|
+
|
|
27
|
+
var rd = fs.createReadStream(source);
|
|
28
|
+
rd.on("error", function(err) {
|
|
29
|
+
done(err);
|
|
30
|
+
});
|
|
31
|
+
var wr = fs.createWriteStream(target);
|
|
32
|
+
wr.on("error", function(err) {
|
|
33
|
+
done(err);
|
|
34
|
+
});
|
|
35
|
+
wr.on("close", function(ex) {
|
|
36
|
+
done();
|
|
37
|
+
});
|
|
38
|
+
rd.pipe(wr);
|
|
39
|
+
|
|
40
|
+
function done(err) {
|
|
41
|
+
if (!cbCalled) {
|
|
42
|
+
cb(err);
|
|
43
|
+
cbCalled = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function find(spec) {
|
|
49
|
+
return helper.find(data, spec);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function tutoriallink(tutorial) {
|
|
53
|
+
return helper.toTutorial(tutorial, null, { tag: 'em', classname: 'disabled', prefix: 'Tutorial: ' });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getAncestorLinks(doclet) {
|
|
57
|
+
return helper.getAncestorLinks(data, doclet);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function hashToLink(doclet, hash) {
|
|
61
|
+
if ( !/^(#.+)/.test(hash) ) { return hash; }
|
|
62
|
+
|
|
63
|
+
var url = helper.createLink(doclet);
|
|
64
|
+
|
|
65
|
+
url = url.replace(/(#.+|$)/, hash);
|
|
66
|
+
return '<a href="' + url + '">' + hash + '</a>';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function needsSignature(doclet) {
|
|
70
|
+
var needsSig = false;
|
|
71
|
+
|
|
72
|
+
// function and class definitions always get a signature
|
|
73
|
+
if (doclet.kind === 'function' || doclet.kind === 'class' && !doclet.hideconstructor) {
|
|
74
|
+
needsSig = true;
|
|
75
|
+
}
|
|
76
|
+
// typedefs that contain functions get a signature, too
|
|
77
|
+
else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names &&
|
|
78
|
+
doclet.type.names.length) {
|
|
79
|
+
for (var i = 0, l = doclet.type.names.length; i < l; i++) {
|
|
80
|
+
if (doclet.type.names[i].toLowerCase() === 'function') {
|
|
81
|
+
needsSig = true;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// and namespaces that are functions get a signature (but finding them is a
|
|
87
|
+
// bit messy)
|
|
88
|
+
else if (doclet.kind === 'namespace' && doclet.meta && doclet.meta.code &&
|
|
89
|
+
doclet.meta.code.type && doclet.meta.code.type.match(/[Ff]unction/)) {
|
|
90
|
+
needsSig = true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return needsSig;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getSignatureAttributes(item) {
|
|
97
|
+
var attributes = [];
|
|
98
|
+
|
|
99
|
+
if (item.optional) {
|
|
100
|
+
attributes.push('opt');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (item.nullable === true) {
|
|
104
|
+
attributes.push('nullable');
|
|
105
|
+
}
|
|
106
|
+
else if (item.nullable === false) {
|
|
107
|
+
attributes.push('non-null');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return attributes;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function updateItemName(item) {
|
|
114
|
+
var attributes = getSignatureAttributes(item);
|
|
115
|
+
var itemName = item.name || '';
|
|
116
|
+
|
|
117
|
+
if (item.variable) {
|
|
118
|
+
itemName = '…' + itemName;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (attributes && attributes.length) {
|
|
122
|
+
itemName = util.format( '%s<span class="signature-attributes">%s</span>', itemName,
|
|
123
|
+
attributes.join(', ') );
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return itemName;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function addParamAttributes(params) {
|
|
130
|
+
return params.filter(function(param) {
|
|
131
|
+
return param.name && param.name.indexOf('.') === -1;
|
|
132
|
+
}).map(updateItemName);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildItemTypeStrings(item) {
|
|
136
|
+
var types = [];
|
|
137
|
+
|
|
138
|
+
if (item && item.type && item.type.names) {
|
|
139
|
+
item.type.names.forEach(function(name) {
|
|
140
|
+
types.push( linkto(name, htmlsafe(name)) );
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return types;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function buildAttribsString(attribs) {
|
|
148
|
+
var attribsString = '';
|
|
149
|
+
|
|
150
|
+
if (attribs && attribs.length) {
|
|
151
|
+
attribsString = htmlsafe( util.format('(%s) ', attribs.join(', ')) );
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return attribsString;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function addNonParamAttributes(items) {
|
|
158
|
+
var types = [];
|
|
159
|
+
|
|
160
|
+
items.forEach(function(item) {
|
|
161
|
+
types = types.concat( buildItemTypeStrings(item) );
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
return types;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function addSignatureParams(f) {
|
|
168
|
+
var params = f.params ? addParamAttributes(f.params) : [];
|
|
169
|
+
f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') );
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function addSignatureReturns(f) {
|
|
173
|
+
var attribs = [];
|
|
174
|
+
var attribsString = '';
|
|
175
|
+
var returnTypes = [];
|
|
176
|
+
var returnTypesString = '';
|
|
177
|
+
var source = f.yields || f.returns;
|
|
178
|
+
|
|
179
|
+
// jam all the return-type attributes into an array. this could create odd results (for example,
|
|
180
|
+
// if there are both nullable and non-nullable return types), but let's assume that most people
|
|
181
|
+
// who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
|
|
182
|
+
if (source) {
|
|
183
|
+
source.forEach(function(item) {
|
|
184
|
+
helper.getAttribs(item).forEach(function(attrib) {
|
|
185
|
+
if (attribs.indexOf(attrib) === -1) {
|
|
186
|
+
attribs.push(attrib);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
attribsString = buildAttribsString(attribs);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (source) {
|
|
195
|
+
returnTypes = addNonParamAttributes(source);
|
|
196
|
+
}
|
|
197
|
+
if (returnTypes.length) {
|
|
198
|
+
returnTypesString = util.format( ' → %s{%s}', attribsString, returnTypes.join('|') );
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
f.signature = '<span class="signature">' + (f.signature || '') + '</span>' +
|
|
202
|
+
'<span class="type-signature">' + returnTypesString + '</span>';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function addSignatureTypes(f) {
|
|
206
|
+
var types = f.type ? buildItemTypeStrings(f) : [];
|
|
207
|
+
|
|
208
|
+
f.signature = (f.signature || '') + '<span class="type-signature">' +
|
|
209
|
+
(types.length ? ' :' + types.join('|') : '') + '</span>';
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function addAttribs(f) {
|
|
213
|
+
var attribs = helper.getAttribs(f);
|
|
214
|
+
var attribsString = buildAttribsString(attribs);
|
|
215
|
+
|
|
216
|
+
f.attribs = util.format('<span class="type-signature">%s</span>', attribsString);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function shortenPaths(files, commonPrefix) {
|
|
220
|
+
Object.keys(files).forEach(function(file) {
|
|
221
|
+
files[file].shortened = files[file].resolved.replace(commonPrefix, '')
|
|
222
|
+
// always use forward slashes
|
|
223
|
+
.replace(/\\/g, '/');
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return files;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function getPathFromDoclet(doclet) {
|
|
230
|
+
if (!doclet.meta) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return doclet.meta.path && doclet.meta.path !== 'null' ?
|
|
235
|
+
path.join(doclet.meta.path, doclet.meta.filename) :
|
|
236
|
+
doclet.meta.filename;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function generate(type, title, docs, filename, resolveLinks) {
|
|
240
|
+
resolveLinks = resolveLinks === false ? false : true;
|
|
241
|
+
|
|
242
|
+
var docData = {
|
|
243
|
+
type: type,
|
|
244
|
+
title: title,
|
|
245
|
+
docs: docs
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
var outpath = path.join(outdir, filename),
|
|
249
|
+
html = view.render('container.tmpl', docData);
|
|
250
|
+
|
|
251
|
+
if (resolveLinks) {
|
|
252
|
+
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
fs.writeFileSync(outpath, html, 'utf8');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function generateSourceFiles(sourceFiles, encoding) {
|
|
259
|
+
encoding = encoding || 'utf8';
|
|
260
|
+
Object.keys(sourceFiles).forEach(function(file) {
|
|
261
|
+
var source;
|
|
262
|
+
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
|
|
263
|
+
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
|
|
264
|
+
helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
|
|
265
|
+
|
|
266
|
+
try {
|
|
267
|
+
source = {
|
|
268
|
+
kind: 'source',
|
|
269
|
+
code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
catch(e) {
|
|
273
|
+
logger.error('Error while generating source file %s: %s', file, e.message);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
generate('Source', sourceFiles[file].shortened, [source], sourceOutfile, false);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Look for classes or functions with the same name as modules (which indicates that the module
|
|
282
|
+
* exports only that class or function), then attach the classes or functions to the `module`
|
|
283
|
+
* property of the appropriate module doclets. The name of each class or function is also updated
|
|
284
|
+
* for display purposes. This function mutates the original arrays.
|
|
285
|
+
*
|
|
286
|
+
* @private
|
|
287
|
+
* @param {Array.<module:jsdoc/doclet.Doclet>} doclets - The array of classes and functions to
|
|
288
|
+
* check.
|
|
289
|
+
* @param {Array.<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.
|
|
290
|
+
*/
|
|
291
|
+
function attachModuleSymbols(doclets, modules) {
|
|
292
|
+
var symbols = {};
|
|
293
|
+
|
|
294
|
+
// build a lookup table
|
|
295
|
+
doclets.forEach(function(symbol) {
|
|
296
|
+
symbols[symbol.longname] = symbols[symbol.longname] || [];
|
|
297
|
+
symbols[symbol.longname].push(symbol);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
return modules.map(function(module) {
|
|
301
|
+
if (symbols[module.longname]) {
|
|
302
|
+
module.modules = symbols[module.longname]
|
|
303
|
+
// Only show symbols that have a description. Make an exception for classes, because
|
|
304
|
+
// we want to show the constructor-signature heading no matter what.
|
|
305
|
+
.filter(function(symbol) {
|
|
306
|
+
return symbol.description || symbol.kind === 'class';
|
|
307
|
+
})
|
|
308
|
+
.map(function(symbol) {
|
|
309
|
+
symbol = doop(symbol);
|
|
310
|
+
|
|
311
|
+
if (symbol.kind === 'class' || symbol.kind === 'function' && !symbol.hideconstructor) {
|
|
312
|
+
symbol.name = symbol.name.replace('module:', '(require("') + '"))';
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return symbol;
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) {
|
|
322
|
+
var nav = '';
|
|
323
|
+
|
|
324
|
+
if (items && items.length) {
|
|
325
|
+
var itemsNav = '';
|
|
326
|
+
var docdash = env && env.conf && env.conf.docdash || {};
|
|
327
|
+
var level = typeof docdash.navLevel === 'number' && docdash.navLevel >= 0 ?
|
|
328
|
+
docdash.navLevel :
|
|
329
|
+
Infinity;
|
|
330
|
+
|
|
331
|
+
items.forEach(function(item) {
|
|
332
|
+
var displayName;
|
|
333
|
+
var methods = find({kind:'function', memberof: item.longname});
|
|
334
|
+
var members = find({kind:'member', memberof: item.longname});
|
|
335
|
+
var conf = env && env.conf || {};
|
|
336
|
+
var classes = '';
|
|
337
|
+
|
|
338
|
+
// show private class?
|
|
339
|
+
if (docdash.private === false && item.access === 'private') return;
|
|
340
|
+
|
|
341
|
+
// depth to show?
|
|
342
|
+
if (item.ancestors && item.ancestors.length > level) {
|
|
343
|
+
classes += 'level-hide';
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
classes = classes ? ' class="'+ classes + '"' : '';
|
|
347
|
+
itemsNav += '<li'+ classes +'>';
|
|
348
|
+
if ( !hasOwnProp.call(item, 'longname') ) {
|
|
349
|
+
itemsNav += linktoFn('', item.name);
|
|
350
|
+
} else if ( !hasOwnProp.call(itemsSeen, item.longname) ) {
|
|
351
|
+
if (conf.templates.default.useLongnameInNav) {
|
|
352
|
+
displayName = item.longname;
|
|
353
|
+
} else {
|
|
354
|
+
displayName = item.name;
|
|
355
|
+
}
|
|
356
|
+
itemsNav += linktoFn(item.longname, displayName.replace(/\b(module|event):/g, ''));
|
|
357
|
+
|
|
358
|
+
if (docdash.static && members.find(function (m) { return m.scope === 'static'; } )) {
|
|
359
|
+
itemsNav += "<ul class='members'>";
|
|
360
|
+
|
|
361
|
+
members.forEach(function (member) {
|
|
362
|
+
if (!member.scope === 'static') return;
|
|
363
|
+
itemsNav += "<li data-type='member'";
|
|
364
|
+
if(docdash.collapse)
|
|
365
|
+
itemsNav += " style='display: none;'";
|
|
366
|
+
itemsNav += ">";
|
|
367
|
+
itemsNav += linkto(member.longname, member.name);
|
|
368
|
+
itemsNav += "</li>";
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
itemsNav += "</ul>";
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (methods.length) {
|
|
375
|
+
itemsNav += "<ul class='methods'>";
|
|
376
|
+
|
|
377
|
+
methods.forEach(function (method) {
|
|
378
|
+
if (docdash.static === false && method.scope === 'static') return;
|
|
379
|
+
if (docdash.private === false && method.access === 'private') return;
|
|
380
|
+
|
|
381
|
+
itemsNav += "<li data-type='method'";
|
|
382
|
+
if(docdash.collapse)
|
|
383
|
+
itemsNav += " style='display: none;'";
|
|
384
|
+
itemsNav += ">";
|
|
385
|
+
itemsNav += linkto(method.longname, method.name);
|
|
386
|
+
itemsNav += "</li>";
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
itemsNav += "</ul>";
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
itemsSeen[item.longname] = true;
|
|
393
|
+
}
|
|
394
|
+
itemsNav += '</li>';
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
if (itemsNav !== '') {
|
|
398
|
+
nav += '<h3>' + itemHeading + '</h3><ul>' + itemsNav + '</ul>';
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return nav;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function linktoTutorial(longName, name) {
|
|
406
|
+
return tutoriallink(name);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function linktoExternal(longName, name) {
|
|
410
|
+
return linkto(longName, name.replace(/(^"|"$)/g, ''));
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Create the navigation sidebar.
|
|
415
|
+
* @param {object} members The members that will be used to create the sidebar.
|
|
416
|
+
* @param {array<object>} members.classes
|
|
417
|
+
* @param {array<object>} members.externals
|
|
418
|
+
* @param {array<object>} members.globals
|
|
419
|
+
* @param {array<object>} members.mixins
|
|
420
|
+
* @param {array<object>} members.modules
|
|
421
|
+
* @param {array<object>} members.namespaces
|
|
422
|
+
* @param {array<object>} members.tutorials
|
|
423
|
+
* @param {array<object>} members.events
|
|
424
|
+
* @param {array<object>} members.interfaces
|
|
425
|
+
* @return {string} The HTML for the navigation sidebar.
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
function buildNav(members) {
|
|
429
|
+
var nav = '<h2><a href="index.html">Home</a></h2>';
|
|
430
|
+
var seen = {};
|
|
431
|
+
var seenTutorials = {};
|
|
432
|
+
var docdash = env && env.conf && env.conf.docdash || {};
|
|
433
|
+
if(docdash.menu){
|
|
434
|
+
for(var menu in docdash.menu){
|
|
435
|
+
nav += '<h2><a ';
|
|
436
|
+
//add attributes
|
|
437
|
+
for(var attr in docdash.menu[menu]){
|
|
438
|
+
nav += attr+'="' + docdash.menu[menu][attr] + '" ';
|
|
439
|
+
}
|
|
440
|
+
nav += '>' + menu + '</a></h2>';
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
var defaultOrder = [
|
|
444
|
+
'Classes', 'Modules', 'Externals', 'Events', 'Namespaces', 'Mixins', 'Tutorials', 'Interfaces'
|
|
445
|
+
];
|
|
446
|
+
var order = docdash.sectionOrder || defaultOrder;
|
|
447
|
+
var sections = {
|
|
448
|
+
Classes: buildMemberNav(members.classes, 'Classes', seen, linkto),
|
|
449
|
+
Modules: buildMemberNav(members.modules, 'Modules', {}, linkto),
|
|
450
|
+
Externals: buildMemberNav(members.externals, 'Externals', seen, linktoExternal),
|
|
451
|
+
Events: buildMemberNav(members.events, 'Events', seen, linkto),
|
|
452
|
+
Namespaces: buildMemberNav(members.namespaces, 'Namespaces', seen, linkto),
|
|
453
|
+
Mixins: buildMemberNav(members.mixins, 'Mixins', seen, linkto),
|
|
454
|
+
Tutorials: buildMemberNav(members.tutorials, 'Tutorials', seenTutorials, linktoTutorial),
|
|
455
|
+
Interfaces: buildMemberNav(members.interfaces, 'Interfaces', seen, linkto),
|
|
456
|
+
};
|
|
457
|
+
order.forEach(member => nav += sections[member]);
|
|
458
|
+
|
|
459
|
+
if (members.globals.length) {
|
|
460
|
+
var globalNav = '';
|
|
461
|
+
|
|
462
|
+
members.globals.forEach(function(g) {
|
|
463
|
+
if ( (docdash.typedefs || g.kind !== 'typedef') && !hasOwnProp.call(seen, g.longname) ) {
|
|
464
|
+
globalNav += '<li>' + linkto(g.longname, g.name) + '</li>';
|
|
465
|
+
}
|
|
466
|
+
seen[g.longname] = true;
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
if (!globalNav) {
|
|
470
|
+
// turn the heading into a link so you can actually get to the global page
|
|
471
|
+
nav += '<h3>' + linkto('global', 'Global') + '</h3>';
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
nav += '<h3>Global</h3><ul>' + globalNav + '</ul>';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return nav;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
@param {TAFFY} taffyData See <http://taffydb.com/>.
|
|
483
|
+
@param {object} opts
|
|
484
|
+
@param {Tutorial} tutorials
|
|
485
|
+
*/
|
|
486
|
+
exports.publish = function(taffyData, opts, tutorials) {
|
|
487
|
+
var docdash = env && env.conf && env.conf.docdash || {};
|
|
488
|
+
data = taffyData;
|
|
489
|
+
|
|
490
|
+
var conf = env.conf.templates || {};
|
|
491
|
+
conf.default = conf.default || {};
|
|
492
|
+
|
|
493
|
+
var templatePath = path.normalize(opts.template);
|
|
494
|
+
view = new template.Template( path.join(templatePath, 'tmpl') );
|
|
495
|
+
|
|
496
|
+
// claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness
|
|
497
|
+
// doesn't try to hand them out later
|
|
498
|
+
var indexUrl = helper.getUniqueFilename('index');
|
|
499
|
+
// don't call registerLink() on this one! 'index' is also a valid longname
|
|
500
|
+
|
|
501
|
+
var globalUrl = helper.getUniqueFilename('global');
|
|
502
|
+
helper.registerLink('global', globalUrl);
|
|
503
|
+
|
|
504
|
+
// set up templating
|
|
505
|
+
view.layout = conf.default.layoutFile ?
|
|
506
|
+
path.getResourcePath(path.dirname(conf.default.layoutFile),
|
|
507
|
+
path.basename(conf.default.layoutFile) ) :
|
|
508
|
+
'layout.tmpl';
|
|
509
|
+
|
|
510
|
+
// set up tutorials for helper
|
|
511
|
+
helper.setTutorials(tutorials);
|
|
512
|
+
|
|
513
|
+
data = helper.prune(data);
|
|
514
|
+
|
|
515
|
+
docdash.sort !== false && data.sort('longname, version, since');
|
|
516
|
+
helper.addEventListeners(data);
|
|
517
|
+
|
|
518
|
+
var sourceFiles = {};
|
|
519
|
+
var sourceFilePaths = [];
|
|
520
|
+
data().each(function(doclet) {
|
|
521
|
+
if(docdash.removeQuotes){
|
|
522
|
+
if(docdash.removeQuotes === "all"){
|
|
523
|
+
if(doclet.name){
|
|
524
|
+
doclet.name = doclet.name.replace(/"/g, '');
|
|
525
|
+
doclet.name = doclet.name.replace(/'/g, '');
|
|
526
|
+
}
|
|
527
|
+
if(doclet.longname){
|
|
528
|
+
doclet.longname = doclet.longname.replace(/"/g, '');
|
|
529
|
+
doclet.longname = doclet.longname.replace(/'/g, '');
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else if(docdash.removeQuotes === "trim"){
|
|
533
|
+
if(doclet.name){
|
|
534
|
+
doclet.name = doclet.name.replace(/^"(.*)"$/, '$1');
|
|
535
|
+
doclet.name = doclet.name.replace(/^'(.*)'$/, '$1');
|
|
536
|
+
}
|
|
537
|
+
if(doclet.longname){
|
|
538
|
+
doclet.longname = doclet.longname.replace(/^"(.*)"$/, '$1');
|
|
539
|
+
doclet.longname = doclet.longname.replace(/^'(.*)'$/, '$1');
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
doclet.attribs = '';
|
|
544
|
+
|
|
545
|
+
if (doclet.examples) {
|
|
546
|
+
doclet.examples = doclet.examples.map(function(example) {
|
|
547
|
+
var caption, code;
|
|
548
|
+
|
|
549
|
+
if (example && example.match(/^\s*<caption>([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) {
|
|
550
|
+
caption = RegExp.$1;
|
|
551
|
+
code = RegExp.$3;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return {
|
|
555
|
+
caption: caption || '',
|
|
556
|
+
code: code || example || ''
|
|
557
|
+
};
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
if (doclet.see) {
|
|
561
|
+
doclet.see.forEach(function(seeItem, i) {
|
|
562
|
+
doclet.see[i] = hashToLink(doclet, seeItem);
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// build a list of source files
|
|
567
|
+
var sourcePath;
|
|
568
|
+
if (doclet.meta) {
|
|
569
|
+
sourcePath = getPathFromDoclet(doclet);
|
|
570
|
+
sourceFiles[sourcePath] = {
|
|
571
|
+
resolved: sourcePath,
|
|
572
|
+
shortened: null
|
|
573
|
+
};
|
|
574
|
+
if (sourceFilePaths.indexOf(sourcePath) === -1) {
|
|
575
|
+
sourceFilePaths.push(sourcePath);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
// update outdir if necessary, then create outdir
|
|
581
|
+
var packageInfo = ( find({kind: 'package'}) || [] ) [0];
|
|
582
|
+
if (packageInfo && packageInfo.name) {
|
|
583
|
+
outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') );
|
|
584
|
+
}
|
|
585
|
+
fs.mkPath(outdir);
|
|
586
|
+
|
|
587
|
+
// copy the template's static files to outdir
|
|
588
|
+
var fromDir = path.join(templatePath, 'static');
|
|
589
|
+
var staticFiles = fs.ls(fromDir, 3);
|
|
590
|
+
|
|
591
|
+
staticFiles.forEach(function(fileName) {
|
|
592
|
+
var toDir = fs.toDir( fileName.replace(fromDir, outdir) );
|
|
593
|
+
fs.mkPath(toDir);
|
|
594
|
+
copyFile(fileName, path.join(toDir, path.basename(fileName)), function(err){if(err) console.err(err);});
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// copy user-specified static files to outdir
|
|
598
|
+
var staticFilePaths;
|
|
599
|
+
var staticFileFilter;
|
|
600
|
+
var staticFileScanner;
|
|
601
|
+
if (conf.default.staticFiles) {
|
|
602
|
+
// The canonical property name is `include`. We accept `paths` for backwards compatibility
|
|
603
|
+
// with a bug in JSDoc 3.2.x.
|
|
604
|
+
staticFilePaths = conf.default.staticFiles.include ||
|
|
605
|
+
conf.default.staticFiles.paths ||
|
|
606
|
+
[];
|
|
607
|
+
staticFileFilter = new (require('jsdoc/src/filter')).Filter(conf.default.staticFiles);
|
|
608
|
+
staticFileScanner = new (require('jsdoc/src/scanner')).Scanner();
|
|
609
|
+
|
|
610
|
+
staticFilePaths.forEach(function(filePath) {
|
|
611
|
+
var extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);
|
|
612
|
+
|
|
613
|
+
extraStaticFiles.forEach(function(fileName) {
|
|
614
|
+
var sourcePath = fs.toDir(filePath);
|
|
615
|
+
var toDir = fs.toDir( fileName.replace(sourcePath, outdir) );
|
|
616
|
+
fs.mkPath(toDir);
|
|
617
|
+
copyFile(fileName, path.join(toDir, path.basename(fileName)), function(err){if(err) console.err(err);});
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
if (sourceFilePaths.length) {
|
|
623
|
+
sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) );
|
|
624
|
+
}
|
|
625
|
+
data().each(function(doclet) {
|
|
626
|
+
var url = helper.createLink(doclet);
|
|
627
|
+
helper.registerLink(doclet.longname, url);
|
|
628
|
+
|
|
629
|
+
// add a shortened version of the full path
|
|
630
|
+
var docletPath;
|
|
631
|
+
if (doclet.meta) {
|
|
632
|
+
docletPath = getPathFromDoclet(doclet);
|
|
633
|
+
docletPath = sourceFiles[docletPath].shortened;
|
|
634
|
+
if (docletPath) {
|
|
635
|
+
doclet.meta.shortpath = docletPath;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
data().each(function(doclet) {
|
|
641
|
+
var url = helper.longnameToUrl[doclet.longname];
|
|
642
|
+
|
|
643
|
+
if (url.indexOf('#') > -1) {
|
|
644
|
+
doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
doclet.id = doclet.name;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
if ( needsSignature(doclet) ) {
|
|
651
|
+
addSignatureParams(doclet);
|
|
652
|
+
addSignatureReturns(doclet);
|
|
653
|
+
addAttribs(doclet);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
// do this after the urls have all been generated
|
|
658
|
+
data().each(function(doclet) {
|
|
659
|
+
doclet.ancestors = getAncestorLinks(doclet);
|
|
660
|
+
|
|
661
|
+
if (doclet.kind === 'member') {
|
|
662
|
+
addSignatureTypes(doclet);
|
|
663
|
+
addAttribs(doclet);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
if (doclet.kind === 'constant') {
|
|
667
|
+
addSignatureTypes(doclet);
|
|
668
|
+
addAttribs(doclet);
|
|
669
|
+
doclet.kind = 'member';
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
var members = helper.getMembers(data);
|
|
674
|
+
members.tutorials = tutorials.children;
|
|
675
|
+
|
|
676
|
+
// output pretty-printed source files by default
|
|
677
|
+
var outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false
|
|
678
|
+
? true
|
|
679
|
+
: false;
|
|
680
|
+
|
|
681
|
+
// add template helpers
|
|
682
|
+
view.find = find;
|
|
683
|
+
view.linkto = linkto;
|
|
684
|
+
view.resolveAuthorLinks = resolveAuthorLinks;
|
|
685
|
+
view.tutoriallink = tutoriallink;
|
|
686
|
+
view.htmlsafe = htmlsafe;
|
|
687
|
+
view.outputSourceFiles = outputSourceFiles;
|
|
688
|
+
|
|
689
|
+
// once for all
|
|
690
|
+
view.nav = buildNav(members);
|
|
691
|
+
attachModuleSymbols( find({ longname: {left: 'module:'} }), members.modules );
|
|
692
|
+
|
|
693
|
+
// generate the pretty-printed source files first so other pages can link to them
|
|
694
|
+
if (outputSourceFiles) {
|
|
695
|
+
generateSourceFiles(sourceFiles, opts.encoding);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
if (members.globals.length) {
|
|
699
|
+
generate('', 'Global', [{kind: 'globalobj'}], globalUrl);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// index page displays information from package.json and lists files
|
|
703
|
+
var files = find({kind: 'file'});
|
|
704
|
+
var packages = find({kind: 'package'});
|
|
705
|
+
|
|
706
|
+
generate('', 'Home',
|
|
707
|
+
packages.concat(
|
|
708
|
+
[{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}]
|
|
709
|
+
).concat(files),
|
|
710
|
+
indexUrl);
|
|
711
|
+
|
|
712
|
+
// set up the lists that we'll use to generate pages
|
|
713
|
+
var classes = taffy(members.classes);
|
|
714
|
+
var modules = taffy(members.modules);
|
|
715
|
+
var namespaces = taffy(members.namespaces);
|
|
716
|
+
var mixins = taffy(members.mixins);
|
|
717
|
+
var externals = taffy(members.externals);
|
|
718
|
+
var interfaces = taffy(members.interfaces);
|
|
719
|
+
|
|
720
|
+
Object.keys(helper.longnameToUrl).forEach(function(longname) {
|
|
721
|
+
var myModules = helper.find(modules, {longname: longname});
|
|
722
|
+
if (myModules.length) {
|
|
723
|
+
generate('Module', myModules[0].name, myModules, helper.longnameToUrl[longname]);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
var myClasses = helper.find(classes, {longname: longname});
|
|
727
|
+
if (myClasses.length) {
|
|
728
|
+
generate('Class', myClasses[0].name, myClasses, helper.longnameToUrl[longname]);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
var myNamespaces = helper.find(namespaces, {longname: longname});
|
|
732
|
+
if (myNamespaces.length) {
|
|
733
|
+
generate('Namespace', myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
var myMixins = helper.find(mixins, {longname: longname});
|
|
737
|
+
if (myMixins.length) {
|
|
738
|
+
generate('Mixin', myMixins[0].name, myMixins, helper.longnameToUrl[longname]);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
var myExternals = helper.find(externals, {longname: longname});
|
|
742
|
+
if (myExternals.length) {
|
|
743
|
+
generate('External', myExternals[0].name, myExternals, helper.longnameToUrl[longname]);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
var myInterfaces = helper.find(interfaces, {longname: longname});
|
|
747
|
+
if (myInterfaces.length) {
|
|
748
|
+
generate('Interface', myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]);
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
// TODO: move the tutorial functions to templateHelper.js
|
|
753
|
+
function generateTutorial(title, tutorial, filename) {
|
|
754
|
+
var tutorialData = {
|
|
755
|
+
title: title,
|
|
756
|
+
header: tutorial.title,
|
|
757
|
+
content: tutorial.parse(),
|
|
758
|
+
children: tutorial.children
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
var tutorialPath = path.join(outdir, filename);
|
|
762
|
+
var html = view.render('tutorial.tmpl', tutorialData);
|
|
763
|
+
|
|
764
|
+
// yes, you can use {@link} in tutorials too!
|
|
765
|
+
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
|
766
|
+
fs.writeFileSync(tutorialPath, html, 'utf8');
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// tutorials can have only one parent so there is no risk for loops
|
|
770
|
+
function saveChildren(node) {
|
|
771
|
+
node.children.forEach(function(child) {
|
|
772
|
+
generateTutorial('Tutorial: ' + child.title, child, helper.tutorialToUrl(child.name));
|
|
773
|
+
saveChildren(child);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
saveChildren(tutorials);
|
|
778
|
+
};
|