当我在项目中将JSDoc与“名称空间”和“模块”一起使用时,列出的类和名称空间文档从模块html页面中消失了

时间:2019-05-16 19:06:12

标签: jsdoc

我正在用JSDoc和Docstrap记录一个项目。

将文档组织到(2)个JS文件(或模块)后,生成的文档就可以了。每个模块列出两个(类)。

接下来,除了“模块”之外,我还包括“命名空间” a。但是,现在在HTML页面中每个模块列出的类都不见了。

问题: 如何使JSDoc继续在模块html页面内包含类列表。

在包含“命名空间”之前输入代码

JS文件:“ ModuleFile01.js”,“ ModuleFile02.js”

ModuleFile01.js

/** 
 * @module Part1/Section01
 * @description Section 01 of Part1
 */

/**
 * Class 1.01
 */
class Part1Class1 {

    /**
     * Constructor
     */
    constructor() {}
}

/**
 * Class 1.02
 */
class Part1Class2 {

    /**
     * Constructor
     */
    constructor() {}
}

ModuleFile02.js

/** 
 * @module Part1/Section02
 * @description Section 02 of Part1
 */

/**
 * Class 1.02
 */
class Part1Class3 {

    /**
     * Constructor
     */
    constructor() {}
}

/**
 * Class 1.02
 */
class Part1Class4 {

    /**
     * Constructor
     */
    constructor() {}

JSDoc配置

{
    "recurseDepth": 10,
    "source": {
        "includePattern": ".+\\.js(doc|x)?$",
        "excludePattern": "(^|\\/|\\\\)_|.+\\.min.js"
    },
    "sourceType": "module",
    "tags": {
        "allowUnknownTags": true,
        "dictionaries": ["jsdoc","closure"]
    },
    "plugins": 
        [   "plugins/markdown"
        ],
    "templates": {
        "outputSourceFiles": true,
        "outputSourcePath": false,
        "cleverLinks": false,
        "monospaceLinks": false,
        "dateFormat": "YYYY-MM-DD HH:MM",
        "systemName": "Test project",
        "footer": "",
        "copyright": "DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.",
        "navType": "vertical",
        "theme": "readable",
        "linenums": true,
        "collapseSymbols": false,
        "inverseNav": true,
        "protocol": "html://",
        "methodHeadingReturns": false
    },
    "markdown": {
        "parser": "gfm",
        "hardwrap": true
    }
}

在包含“命名空间”之前,JSDoc调试输出

DEBUG: JSDoc 3.5.5 (Thu, 14 Sep 2017 02:51:54 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":["plugins/markdown"],"recurseDepth":10,"source":{"includePattern":".+\\.js(doc|x)?$","excludePattern":"(^|\\/|\\\\)_|.+\\.min.js"},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"outputSourceFiles":true,"outputSourcePath":false,"dateFormat":"YYYY-MM-DD HH:MM","systemName":"Test project","footer":"","copyright":"DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.","navType":"vertical","theme":"readable","linenums":true,"collapseSymbols":false,"inverseNav":true,"protocol":"html://","methodHeadingReturns":false},"markdown":{"parser":"gfm","hardwrap":true}},"opts":{"_":["src"],"configure":"JSDoc.cfg.json","template":"C:/Users/cpass/node_modules/ink-docstrap/template","destination":"doc","recurse":true,"verbose":true,"debug":true,"encoding":"utf8"}}}
DEBUG: Parsing source files: ["D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test01\\src\\ModuleFile01.js","D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test01\\src\\ModuleFile02.js"]
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test01\src\ModuleFile01.js ...
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test01\src\ModuleFile02.js ...
DEBUG: Finished parsing source files.
DEBUG: Indexing doclets...
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...
Finished running in 0.48 seconds.

包含“命名空间”后的输入代码

JS文件:“猫类”,“ ModuleFile01.js”,“ ModuleFile02.js”

Cat-Classes.js (仅文档,无代码)

/** 
 * @namespace sections
 * @description Section 01 and 02 of Part1
 * The html page for this namespace lists all classes from "Module01.js" and "Module01.js".
 */

ModuleFile01.js

/** 
 * @module Part1/Section01
 * @description Section 01 of Part1
 */

/**
 * Class 1.01
 * @memberof sections
 */
class Part1Class1 {

    /**
     * Constructor
     */
    constructor() {}
}

/**
 * Class 1.02
 * @memberof sections
 */
class Part1Class2 {

    /**
     * Constructor
     */
    constructor() {}
}

ModuleFile02.js

/** 
 * @module Part1/Section02
 * @description Section 02 of Part1
 */

/**
 * Class 1.02
 * @memberof sections
 */
class Part1Class3 {

    /**
     * Constructor
     */
    constructor() {}
}

/**
 * Class 1.02
 * @memberof sections
 */
class Part1Class4 {

    /**
     * Constructor
     */
    constructor() {}
}

包含“ namespace”:“ sections”后的JSDoc调试输出

DEBUG: JSDoc 3.5.5 (Thu, 14 Sep 2017 02:51:54 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":["plugins/markdown"],"recurseDepth":10,"source":{"includePattern":".+\\.js(doc|x)?$","excludePattern":"(^|\\/|\\\\)_|.+\\.min.js"},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"outputSourceFiles":true,"outputSourcePath":false,"dateFormat":"YYYY-MM-DD HH:MM","systemName":"Test project","footer":"","copyright":"DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.","navType":"vertical","theme":"readable","linenums":true,"collapseSymbols":false,"inverseNav":true,"protocol":"html://","methodHeadingReturns":false},"markdown":{"parser":"gfm","hardwrap":true}},"opts":{"_":["src"],"configure":"JSDoc.cfg.json","template":"C:/Users/cpass/node_modules/ink-docstrap/template","destination":"doc","recurse":true,"verbose":true,"debug":true,"encoding":"utf8"}}}
DEBUG: Parsing source files: ["D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test02\\src\\Cat-Classes.js","D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test02\\src\\ModuleFile01.js","D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test02\\src\\ModuleFile02.js"]
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test02\src\Cat-Classes.js ...
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test02\src\ModuleFile01.js ...
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test02\src\ModuleFile02.js ...
DEBUG: Finished parsing source files.
DEBUG: Indexing doclets...
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...
Finished running in 0.51 seconds.

我正在用JSDoc和Docstrap记录一个项目。

创建的项目包含两个(2)JS文件(或模块),每个JS文件两个(2)类。 每个模块网页都列出了模块内部的类。

我成功创建了一个包含模块的文档,并创建了一个“命名空间”,其中列出了ModuleFile01.js和ModuleFile02.js文件中的所有类

我刚刚创建了一个JS文件,没有代码,只有文档。

现在,文档包括一个“命名空间”,列出了所有项目类。 但是,现在html页面中每个模块列出的类消失了。

问题: 如何使JSDoc继续在模块html页面内包含类列表。

我的环境

|软件|版本| | :--------------- | :------ | | JSDoc | JSDoc 3.5.5(2017年9月14日星期四02:51:54 GMT)| | Node.js | v10.15.0 | | npm | 6.4.1 | |作业系统| Windows 10 Pro,64位,版本1809(操作系统内部版本17763.503)|

0 个答案:

没有答案