add new format for jsdoc

This commit is contained in:
Aleksey Chichenkov 2020-03-31 14:06:26 +03:00
parent eeb2b01574
commit 7c96a53766
19 changed files with 2575 additions and 24 deletions

31
conf.example.json Normal file
View File

@ -0,0 +1,31 @@
{
"tags": {
"allowUnknownTags": true
},
"recurseDepth": 10,
"source": {
"include": ["docfiles"],
"include_2": ["../../develop/first/gui/js/providers"],
"include_3": ["../../develop/first/gui/js"],
"core": ["../../develop/first/core"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"opts" : {
"template": "templates/jaguarjs-jsdoc",
"encoding": "utf8",
"readme": "",
"recurse": true,
"destination": "example-docs/"
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"default": {
"outputSourceFiles": true
}
}
}

31
conf2.json Normal file
View File

@ -0,0 +1,31 @@
{
"tags": {
"allowUnknownTags": true
},
"recurseDepth": 10,
"source": {
"include": ["docfiles"],
"include_2": ["../../develop/first/gui/js/providers"],
"include_3": ["../../develop/first/gui/js"],
"core": ["../../develop/first/core"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"opts" : {
"template": "templates/initi2",
"encoding": "utf8",
"readme": "",
"recurse": true,
"destination": "docs/"
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"default": {
"outputSourceFiles": true
}
}
}

142
docfiles/custom/context.js Normal file
View File

@ -0,0 +1,142 @@
/**
* ### Документация по работе с GUI версии 2.9.1
*
* @name 01
* @context
* @memberof context
*/
/**
* ### Контекстное меню
*
* <br>
*
* #### Протокол
| type | command | data |
|------------- |------------------------------ |----------------------------------------------------------------------------- |
| GUI => CORE | requestContext | |
| CORE => GUI | responseContext | result: List(VariableContainer)<br>proxyData: VariableContainer |
| GUI => CORE | executeContextAction | action: String,<br>data: VariableContainer,<br>proxyData: VariableContainer |
| CORE => GUI | executeContextActionResponse | wizard: Boolean,<br>result: Map(Integer, Integer) |
<br>
#### Описание содержимого responseContext.result
| name | type | description |
|---------- |------------------- |-------------------------------------------------------------------- |
| id | String | Идентификатор, пункта меню |
| type | Integer | Тип пункта меню |
| parentId | String | Родительский ПМ, если его нет, то "" |
| name | String | Локализация названия |
| options | VariableContainer | Данные, которые сопутствую ПМ, в зависимости от контекста действия |
<br>
#### Описание типов, пунктов контекстного меню
| id | name | descriptions | options |
|---- |----------- |--------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------ |
| 0 | group | пункт меню (ПМ), который содержит в себе подпункты | VariableContainer[] |
| 1 | simple | ПМ, который исполняет запрос к ядру (executeAction) | VariableContainer[] |
| 2 | guiAction | действие которое исполняется со стороны GUI. | Опции, специфичные для id |
| 3 | dialog | ПМ, который откроет диалог, который необходимо заполнить и исполнит запрос к ядру (executeAction) | VariableContainer [<br> type: String,<br> data: VariableContainer<br>] |
| 4 | widget | ПМ, который любой виджет | VariableContainer [<br> type: String,<br> data: VariableContainer<br>] |
* #### Пример ответа
*
* ```
VariableContainer [
errCode : 0,
proxyData : VariableContainer [
nodeIds : Set(Integer) [
0
]
],
result : List(VariableContainer) [
VariableContainer [
options : VariableContainer [
],
id : "model",
parentId : "",
type : 2,
name : "Модель"
],
VariableContainer [
options : VariableContainer [
data : VariableContainer [
label : "Введите название для нового контейнера",
formVC : VariableContainer [
data : VariableContainer [
rules : List(VariableContainer) [
VariableContainer [
id : "name",
message : "Имя не может быть пустым",
validator : "input.size() > 0"
]
],
data : List(VariableContainer) [
VariableContainer [
value : "",
id : "name",
title : "Название",
viewer : VariableContainer [
data : VariableContainer [
vc : true
],
type : "LabelString"
],
editor : "Textbox"
]
]
],
type : "Form"
],
windowOptions : VariableContainer [
width : VariableContainer [
type : 0,
data : 300
],
height : VariableContainer [
type : 0,
data : 160
]
]
],
type : "VariablesForm"
],
id : "addContainer",
parentId : "",
type : 3,
name : "Добавить контейнер"
],
VariableContainer [
options : VariableContainer [
],
id : "shortcutTopology",
parentId : "",
type : 1,
name : "Создать ярлык на рабочем столе"
],
VariableContainer [
options : VariableContainer [
],
id : "inventory",
parentId : "",
type : 1,
name : "Синхронизация инвентаря"
]
],
command : "responseContext"
]
* ```
*
* @name 02
* @context
* @memberof context
*/

1593
docfiles/custom/editors.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
/**
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 3/4/20.
*/
/**
* ### Документация по работе с GUI версии 2.9.1
*
* asdf
* as
* dfa
* sdf
* asdf
*
* @name 01
* @protocol
* @memberof protocol
*/

View File

@ -50,7 +50,11 @@
* - - #### {@link std} - реализация сишной библиотеки на js.
* - - #### {@link v2} - сериализуемые типы, которыми можно обмениваться с ядром.
* - - #### {@link tools} - разного рода хелперы и инструменты.
*
* - #### Дополнительные материалы
* - - #### [Эдиторы](./editors.html)
* - - #### Протоколы
* - - - #### [Контекстное меню](./context.html)
* @name 02
* @mainpage
* @memberof mainpage

View File

@ -0,0 +1,4 @@
/**
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 12/16/19.
*/

View File

@ -31,24 +31,34 @@
*
*
* <br>
* Список доступных тегов деревьев:
* - "cmp" - Компоненты
* - "cst" - Вложенность компонентов
* - "dsk" - Рабочий стол
* - "ect" - Дерево событий
* - "flt" - Фильтры
* - "edg" - Линки
* - "cedg" - Вложенность линков
* - "prf" - Профили
* - "rmt" - Сборщики данных
* - "st" - Схема объектов
* - "uat" - Пользовательские данные
* - "dptt" - ???
* - "ecst" - ???
* - "gat" - Глобальное дерево с атрибутами
* - "gt" - Глобальное дерево
* - "rlt" - ???
* - "role" - ???
* Список доступных тегов деревьев:
*
* att - Массовые операций
* cedg - Вложенность линков
* chp - Провайдеры клик-хауса
* cmp - Компоненты
* cst - Вложенность компонентов
* dsk - Рабочий стол
* dst - Датасорсы
* ecst - Вложенность линков
* ect - Дерево событий
* edg - Дерево эджей (линков)
* gat - Глобальное дерево с атрибутами (Прототип)
* gt - Глобальное дерево (Прототип)
* flt - Фильтры
* fmt - Файловый менеджер
* ppt - Профили опроса
* prf - Профили авторизации
* rlt - Правила
* rmt - Сборщики данных
* rtt - Отчеты
* smptt - Мастер провайдеры
* ssptt - Слейв провайдеры
* st - Схема объектов
* uat - Пользовательские данные
* wmptt - WMI Master
* wsptt - WMI Slave
*
*
* <br>
* Связанные объекты:

View File

@ -5,4 +5,29 @@
*/
function Node() {
/**
* Возвращает адрес модели связанный с этой нодой.
*
* @public
* @function model_addr
* @memberof Trees.SchemeTree.Node
* @returns {v2.address}
*/
this.model_addr = function() {
};
/**
* Указывает, является ли данная нода контейнером.
*
* @public
* @function is_container
* @memberof Trees.SchemeTree.Node
* @returns {v2.boolean}
*/
this.is_container = function() {
};
}

4
examples/test.js Normal file
View File

@ -0,0 +1,4 @@
/**
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 12/17/19.
*/

View File

@ -251,6 +251,7 @@ function generate(title, docs, filename, resolveLinks) {
}
fs.writeFileSync(outpath, html, 'utf8');
return outpath;
}
function generateSourceFiles(sourceFiles, encoding) {
@ -650,6 +651,7 @@ var find_first_members = function (_parent, _clss) {
global.typedefs = {};
global.mainpage_content = [];
global.cusomData = Object.create(null);
var find_tag_by_id = function (_tags, _tag_id) {
for (var a = 0; a < _tags.length; a++) {
@ -718,17 +720,27 @@ exports.publish = function(taffyData, opts, tutorials) {
helper.addEventListeners(data);
data().each(function(doclet){
// console.log(doclet);
if(doclet.kind == "typedef") {
typedefs[doclet.longname] = doclet;
}
if(doclet.tags && find_tag_by_id(doclet.tags, "mainpage")){
// console.log(doclet);
mainpage_content.push(doclet);
}
if(doclet.meta && doclet.meta.path) {
var path = doclet.meta.path.split("/");
if(path[path.length - 1] === "custom") {
var id = doclet.meta.filename.split(".")[0];
if (!cusomData[id])
cusomData[id] = [];
if (doclet.tags && find_tag_by_id(doclet.tags, id))
cusomData[id].push(doclet);
}
}
});
@ -877,6 +889,7 @@ exports.publish = function(taffyData, opts, tutorials) {
// add template helpers
view.content = mainpage_content;
view.cusomData = cusomData;
view.find = find;
view.linkto = linkto;
view.replace_enters_to_br = replace_enters_to_br;
@ -910,9 +923,25 @@ exports.publish = function(taffyData, opts, tutorials) {
).concat(files), indexUrl);
console.log("outdir", outdir)
// console.log("indexUrl", indexUrl)
for(var id in cusomData) {
var out = generate(id,
packages.concat(
[{
subkind: id,
kind: 'custom',
readme: opts.readme,
longname: id
}]
).concat(files), id + ".html");
console.log("generate", id, out)
}
var sih = require("./search_inheritance.js");
var inh_struct = sih.find(env.conf, helper, logger, generate);

View File

@ -93,6 +93,12 @@ div.part > div.desc {
padding: 5px;
}
pre.source {
margin-top: 5px;
margin-bottom: 5px;
}
div.container-overview > .desc > pre,
div.part > pre {
margin: 0px;
@ -194,3 +200,15 @@ h4, h4 a
.compact-method * {
word-spacing: 0px;
}
h3 > a.title {
cursor: pointer;
text-decoration: none;
}
h5 {
margin-block-start: 0;
margin-block-end: 0;
margin-top: 0;
margin-bottom: 0;
}

View File

@ -197,7 +197,7 @@ h5, .container-overview .subsection-title
font-size: 120%;
font-weight: bold;
letter-spacing: -0.01em;
margin: 8px 0 3px 0;
/*margin: 8px 0 3px 0;*/
}
.container-overview > h3 {
@ -235,6 +235,7 @@ table
td, th
{
background-color: #ffffff63;
border: 1px solid #ddd;
margin: 0px;
text-align: left;

View File

@ -18,8 +18,16 @@
isGlobalPage = (doc.kind === 'globalobj');
}
?>
<?js if (doc.kind === 'mainpage' /* || (doc.kind === 'package') */) { ?>
<?js if (doc.kind === 'custom') { ?>
<?js= self.partial('custom.tmpl', doc) ?>
<?js } else if (doc.kind === 'mainpage') { ?>
<?js= self.partial('mainpage.tmpl', doc) ?>
<?js } else if (doc.kind === 'other') { ?>
<?js= self.partial('other.tmpl', doc) ?>
<?js } else if (doc.kind === 'source') { ?>
<?js= self.partial('source.tmpl', doc) ?>
<?js } else { ?>

View File

@ -0,0 +1,16 @@
<?js
var data = obj;
var self = this;
?>
<style>
div#main section {
display: none;
}
</style>
<?js= self.partial('mainpage/each.tmpl', self.cusomData[data.subkind]) ?>
<?js if (data.kind === 'package') { ?>
<h3><?js= data.name ?> <?js= data.version ?></h3>
<?js } ?>

View File

@ -0,0 +1,14 @@
/**
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 12/16/19.
*/
const Render = require("./render");
// do stuff here to generate your output files
exports.publish = function(data, opts, tutorials) {
this.render = new Render(data, opts, tutorials);
this.render.init();
};

550
templates/initi2/render.js Normal file
View File

@ -0,0 +1,550 @@
/**
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 12/16/19.
*/
const fs = require("fs");
const util = require('util');
const helper = require('jsdoc/util/templateHelper');
const path = require('jsdoc/path');
const jfs = require('jsdoc/fs');
const env = require('jsdoc/env');
const template = require('jsdoc/template');
const taffy = require('taffydb').taffy;
const htmlsafe = helper.htmlsafe;
const linkto = helper.linkto;
class Render {
/**
*
* @param _taffyData
* @param _opts
*/
constructor (_taffyData, _opts, _tutorials) {
this._taffyData = _taffyData;
this._opts = _opts;
this._tutorials = _tutorials;
this._sourceFiles = {};
this._sourceFilePaths = [];
}
init() {
this._outdir = path.normalize(this._opts.destination);
this._templatePath = path.normalize(this._opts.template);
this._conf = env.conf.templates || {};
this._conf.default = this._conf.default || {};
this._indexUrl = helper.getUniqueFilename('index');
this._outputSourceFiles = this._conf.default && this._conf.default.outputSourceFiles !== false;
this._upgradeData();
this._createFileWithDocklets();
this._createOutdir();
this._copyStaticFiles();
this._processExamples();
this._processSee();
this._buildListSourceFiles();
this._buildLinks();
this._addAttribsAndSignature(); // what it do is
this._buildMenu();
this._findMembers();
this._initTemplate();
this._generateFiles();
// index page displays information from package.json and lists files
var files = this.find({kind: 'file'});
var packages = this.find({kind: 'package'});
this.generate('Documentation: GUI 2.9.1-develop',
packages.concat(
[{
kind: 'mainpage',
readme: this._opts.readme,
longname: (this._opts.mainpagetitle) ? this._opts.mainpagetitle : 'Main Page'
}]
).concat(files), this._indexUrl);
}
_upgradeData () {
this._data = helper.prune(this._taffyData);
this._data.sort('longname, version, since');
}
_createFileWithDocklets () {
var data = [];
this._taffyData().each(function (_data) {
data.push(_data);
});
fs.writeFileSync("taffy.json", JSON.stringify(data, true, 3));
}
_createOutdir () {
var packageInfo = (this.find({kind: 'package'}) || [])[0];
if (packageInfo && packageInfo.name) {
this._outdir = path.join(this._outdir, packageInfo.name, (packageInfo.version || ''));
}
jfs.mkPath(this._outdir);
}
_copyStaticFiles () {
var fromDir = path.join(this._templatePath, 'static');
var staticFiles = jfs.ls(fromDir, 3);
staticFiles.forEach(function(fileName) {
var toDir = jfs.toDir( fileName.replace(fromDir, outdir) );
jfs.mkPath(toDir);
jfs.copyFileSync(fileName, toDir);
});
if (this._conf.default.staticFiles) {
// The canonical property name is `include`. We accept `paths` for backwards compatibility
// with a bug in JSDoc 3.2.x.
var staticFilePaths = this._conf.default.staticFiles.include ||
this._conf.default.staticFiles.paths ||
[];
var staticFileFilter = new (require('jsdoc/src/filter')).Filter(this._conf.default.staticFiles);
var staticFileScanner = new (require('jsdoc/src/scanner')).Scanner();
staticFilePaths.forEach(function(filePath) {
var extraStaticFiles;
filePath = path.resolve(env.pwd, filePath);
extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);
extraStaticFiles.forEach(function(fileName) {
var sourcePath = jfs.toDir(filePath);
var toDir = jfs.toDir( fileName.replace(sourcePath, outdir) );
jfs.mkPath(toDir);
jfs.copyFileSync(fileName, toDir);
}.bind(this));
}.bind(this));
}
}
_processExamples (){
this._data().each(function(doclet) {
doclet.attribs = '';
if (doclet.examples) {
doclet.examples = doclet.examples.map(function (example) {
var caption;
var code;
if (example.match(/^\s*<caption>([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) {
caption = RegExp.$1;
code = RegExp.$3;
}
return {
caption: caption || '',
code: code || example
};
}.bind(this));
}
}.bind(this))
}
_processSee (){
this._data().each(function(doclet) {
if (doclet.see) {
doclet.see.forEach(function(seeItem, i) {
doclet.see[i] = hashToLink(doclet, seeItem);
});
}
}.bind(this))
}
_buildListSourceFiles (){
var sourcePath;
this._data().each(function(doclet) {
// build a list of source files
if (doclet.meta) {
sourcePath = getPathFromDoclet(doclet);
this._sourceFiles[sourcePath] = {
resolved: sourcePath,
shortened: null
};
if (this._sourceFilePaths.indexOf(sourcePath) === -1) {
this._sourceFilePaths.push(sourcePath);
}
}
}.bind(this));
if (this._sourceFilePaths.length) {
this._sourceFiles = shortenPaths( this._sourceFiles, path.commonPrefix(this._sourceFilePaths) );
}
}
_buildLinks () {
this._data().each(function(doclet) {
var docletPath;
var url = helper.createLink(doclet);
helper.registerLink(doclet.longname, url);
// add a shortened version of the full path
if (doclet.meta) {
docletPath = getPathFromDoclet(doclet);
docletPath = this._sourceFiles[docletPath].shortened;
if (docletPath) {
doclet.meta.shortpath = docletPath;
}
}
}.bind(this));
}
_addAttribsAndSignature () {
this._data().each(function (doclet) {
var url = helper.longnameToUrl[doclet.longname];
if (url.indexOf('#') > -1) {
doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
} else {
doclet.id = doclet.name;
}
if (needsSignature(doclet)) {
addSignatureParams(doclet);
addSignatureReturns(doclet);
addAttribs(doclet);
}
}.bind(this));
// do this after the urls have all been generated
this._data().each(function(doclet) {
doclet.ancestors = this.getAncestorLinks(doclet);
if (doclet.kind === 'member') {
addSignatureTypes(doclet);
addAttribs(doclet);
}
if (doclet.kind === 'constant') {
addSignatureTypes(doclet);
addAttribs(doclet);
doclet.kind = 'member';
}
}.bind(this));
}
_buildMenu () {
}
_findMembers() {
this._members = helper.getMembers(this._data);
this._members.tutorials = this._tutorials.children;
}
_initTemplate () {
this._view = new template.Template( path.join(this._templatePath, 'tmpl') );
this._view.find = this.find.bind(this);
this._view.linkto = linkto;
this._view.resolveAuthorLinks = helper.resolveAuthorLinks;
this._view.tutoriallink = tutoriallink;
this._view.htmlsafe = htmlsafe;
this._view.outputSourceFiles = this._outputSourceFiles;
// set up templating
if(this._conf.default.layoutFile) {
this._view.layout = path.getResourcePath(path.dirname(this._conf.default.layoutFile), path.basename(this._conf.default.layoutFile))
} else {
this._view.layout = 'layout.tmpl'
}
}
_generateFiles() {
// output pretty-printed source files by default
if (this._outputSourceFiles) {
this.generateSourceFiles(this._sourceFiles, this._opts.encoding);
}
// set up the lists that we'll use to generate pages
this._classes = taffy(this._members.classes);
this._modules = taffy(this._members.modules);
this._namespaces = taffy(this._members.namespaces);
this._mixins = taffy(this._members.mixins);
this._externals = taffy(this._members.externals);
this._interfaces = taffy(this._members.interfaces);
Object.keys(helper.longnameToUrl).forEach(function(longname) {
var myClasses = helper.find(this._classes, {longname: longname});
var myExternals = helper.find(this._externals, {longname: longname});
var myInterfaces = helper.find(this._interfaces, {longname: longname});
var myMixins = helper.find(this._mixins, {longname: longname});
var myModules = helper.find(this._modules, {longname: longname});
var myNamespaces = helper.find(this._namespaces, {longname: longname});
if (myModules.length) {
this.generate('Module: ' + myModules[0].name, myModules, helper.longnameToUrl[longname]);
}
if (myClasses.length) {
this.generate(myClasses[0].name, myClasses, helper.longnameToUrl[longname]);
}
if (myNamespaces.length) {
this.generate(myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]);
}
if (myMixins.length) {
this.generate('Mixin: ' + myMixins[0].name, myMixins, helper.longnameToUrl[longname]);
}
if (myExternals.length) {
this.generate('External: ' + myExternals[0].name, myExternals, helper.longnameToUrl[longname]);
}
if (myInterfaces.length) {
this.generate('Interface: ' + myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]);
}
}.bind(this));
}
generate(title, docs, filename, resolveLinks) {
var docData;
var html;
var outpath;
resolveLinks = resolveLinks !== false;
docData = {
env: env,
title: title,
docs: docs
};
outpath = path.join(this._outdir, filename);
html = this._view.render('container.tmpl', docData);
if (resolveLinks) {
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
}
fs.writeFileSync(outpath, html, 'utf8');
}
generateSourceFiles(sourceFiles, encoding) {
this._encoding = encoding || 'utf8';
Object.keys(this._sourceFiles).forEach(function(file) {
var source;
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(this._sourceFiles[file].shortened);
helper.registerLink(this._sourceFiles[file].shortened, sourceOutfile);
try {
source = {
kind: 'source',
code: helper.htmlsafe( fs.readFileSync(this._sourceFiles[file].resolved, this._encoding) )
};
}
catch (e) {
logger.error('Error while generating source file %s: %s', file, e.message);
}
this.generate('Source: ' + this._sourceFiles[file].shortened, [source], sourceOutfile, false);
}.bind(this));
}
getAncestorLinks(doclet) {
return helper.getAncestorLinks(this._data, doclet);
}
find(spec) {
return helper.find(this._data, spec);
}
}
// local functions
function tutoriallink(tutorial) {
return helper.toTutorial(tutorial, null, {
tag: 'em',
classname: 'disabled',
prefix: 'Tutorial: '
});
}
function shortenPaths(files, commonPrefix) {
Object.keys(files).forEach(function(file) {
files[file].shortened = files[file].resolved.replace(commonPrefix, '')
// always use forward slashes
.replace(/\\/g, '/');
});
return files;
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return null;
}
return doclet.meta.path && doclet.meta.path !== 'null' ?
path.join(doclet.meta.path, doclet.meta.filename) :
doclet.meta.filename;
}
function needsSignature(doclet) {
var needsSig = false;
// function and class definitions always get a signature
if (doclet.kind === 'function' || doclet.kind === 'class') {
needsSig = true;
}
// typedefs that contain functions get a signature, too
else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names &&
doclet.type.names.length) {
for (var i = 0, l = doclet.type.names.length; i < l; i++) {
if (doclet.type.names[i].toLowerCase() === 'function') {
needsSig = true;
break;
}
}
}
// and namespaces that are functions get a signature (but finding them is a
// bit messy)
else if (doclet.kind === 'namespace' && doclet.meta && doclet.meta.code &&
doclet.meta.code.type && doclet.meta.code.type.match(/[Ff]unction/)) {
needsSig = true;
}
return needsSig;
}
function addSignatureTypes(f) {
var types = f.type ? buildItemTypeStrings(f) : [];
f.signature = (f.signature || '') + '<span class="type-signature">' +
(types.length ? ' :' + types.join('|') : '') + '</span>';
}
function getSignatureAttributes(item) {
var attributes = [];
if (item.optional) {
attributes.push('opt');
}
if (item.nullable === true) {
attributes.push('nullable');
}
else if (item.nullable === false) {
attributes.push('non-null');
}
return attributes;
}
function updateItemName(item) {
var attributes = getSignatureAttributes(item);
var itemName = item.name || '';
if (item.variable) {
itemName = '&hellip;' + itemName;
}
if (attributes && attributes.length) {
itemName = util.format( '%s<span class="signature-attributes">%s</span>', itemName,
attributes.join(', ') );
}
return itemName;
}
function addParamAttributes(params) {
return params.filter(function(param) {
return param.name && param.name.indexOf('.') === -1;
}).map(updateItemName);
}
function addSignatureParams(f) {
var params = f.params ? addParamAttributes(f.params) : [];
f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') );
}
function buildItemTypeStrings(item) {
var types = [];
if (item && item.type && item.type.names) {
item.type.names.forEach(function(name) {
types.push( linkto(name, htmlsafe(name)) );
});
}
return types;
}
function addNonParamAttributes(items) {
var types = [];
items.forEach(function(item) {
types = types.concat( buildItemTypeStrings(item) );
});
return types;
}
function buildAttribsString(attribs) {
var attribsString = '';
if (attribs && attribs.length) {
attribsString = htmlsafe( util.format('(%s) ', attribs.join(', ')) );
}
return attribsString;
}
function addSignatureReturns(f) {
var attribs = [];
var attribsString = '';
var returnTypes = [];
var returnTypesString = '';
var source = f.yields || f.returns;
// jam all the return-type attributes into an array. this could create odd results (for example,
// if there are both nullable and non-nullable return types), but let's assume that most people
// who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
if (source) {
source.forEach(function(item) {
helper.getAttribs(item).forEach(function(attrib) {
if (attribs.indexOf(attrib) === -1) {
attribs.push(attrib);
}
});
});
attribsString = buildAttribsString(attribs);
}
if (source) {
returnTypes = addNonParamAttributes(source);
}
if (returnTypes.length) {
returnTypesString = util.format( ' &rarr; %s{%s}', attribsString, returnTypes.join('|') );
}
f.signature = '<span class="signature">' + (f.signature || '') + '</span>' +
'<span class="type-signature">' + returnTypesString + '</span>';
}
function addAttribs(f) {
var attribs = helper.getAttribs(f);
var attribsString = buildAttribsString(attribs);
f.attribs = util.format('<span class="type-signature">%s</span>', attribsString);
}
module.exports = Render;

View File

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Initi documentation for GUI(2.9.1-develop) <?js= title ?></title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<script src="scripts/dd-menu.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/common.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
<link type="text/css" rel="stylesheet" href="styles/dd-menu.css">
<link type="text/css" rel="stylesheet" href="styles/explorer.css">
<link type="text/css" rel="stylesheet" href="styles/members.css">
<link type="text/css" rel="stylesheet" href="styles/mainpage.css">
</head>
<body>
<script>
document.body.style.display = "none";
window.addEventListener("load", function () {
document.body.style.display = "block";
})
</script>
<div id="main">
<h1 class="page-title"><?js= title ?></h1>
<?js= content ?>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc <?js= env.version.number ?></a><?js if(env.conf.templates && env.conf.templates.default && env.conf.templates.default.includeDate !== false) { ?> on <?js= (new Date()) ?><?js } ?>
</footer>
</div>
<nav>
<?js= this.nav ?>
</nav>
<br class="clear">
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>