jsdoc使用

//使用说明:
java -jar jsrun.jar app/run.js --help

USAGE: java -jar jsrun.jar app/run.js [OPTIONS] <SRC_DIR> <SRC_FILE> ...

OPTIONS:
  -a or --allfunctions
          Include all functions, even undocumented ones.

  -c or --conf
          Load a configuration file.

  -d=<PATH> or --directory=<PATH>
          Output to this directory (defaults to "out").

  -D="myVar:My value" or --define="myVar:My value"
          Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.m

  -e=<ENCODING> or --encoding=<ENCODING>
          Use this encoding to read and write files.

  -E="REGEX" or --exclude="REGEX"
          Multiple. Exclude files based on the supplied regex.

  -h or --help
          Show this message and exit.

  -n or --nocode
          Ignore all code, only document comments with @name tags.

  -o=<PATH> or --out=<PATH>
          Print log messages to a file (defaults to stdout).

  -p or --private
          Include symbols tagged as private, underscored and inner symbols

  -q or --quiet
          Do not output any messages, not even warnings.

  -r=<DEPTH> or --recurse=<DEPTH>
          Descend into src directories.

  -s or --suppress
          Suppress source code output.

  -S or --securemodules
          Use Secure Modules mode to parse source code.

  -t=<PATH> or --template=<PATH>
          Required. Use this template to format the output.

  -T or --test
          Run all unit tests and exit.

  -u or --unique
          Force file names to be unique, but not based on symbol names.

  -v or --verbose
          Provide verbose feedback about what is happening.

  -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...
          Scan source files with the given extension/s (defaults to js).
	  
   This is an example of one way you could set up a configuration file to more
	conveniently define some commandline options. You might like to do this if
	you frequently reuse the same options. Note that you don't need to define
	every option in this file, you can combine a configuration file with
	additional options on the commandline if your wish.
	
	You would include this configuration file by running JsDoc Toolkit like so:
	java -jar jsrun.jar app/run.js -c=conf/sample.conf

下面列出了可以创建HTML文档的一些特殊 JSDoc标记。如果你曾在Java代码中编写过javadoc注释,应该对这些标记并不陌生。如果要在最后生成的文档中包含某个注释块,所有这些注释块都必须以/**开头,并以*/结束。

JSDoc 命令属性

命令名                描述
@param
@argument           指定参数名和说明来描述一个函数参数。
@return
@returns              描述函数的返回值。
@author               指示代码的作者。
@deprecated     指示一个函数已经废弃,不建议使用,而且在将来版本的代码中可能会彻底删除。要避免使用这段代码。
@see                    创建一个HTML链接指向指定类的描述。
@version              指定发布版本。
@requires             创建一个HTML链接,指向这个类所需的指定类。
@throws
@exception           描述函数可能抛出的异常的类型。
{@link}                创建一个HTML链接,指向指定的类。这与@see很类似,但{@link}能嵌在注释文本中。
@author                指示代码的作者。(译者注:这个标记前面已经出现过,建议去掉)
@fileoverview     这是一个特殊的标记,如果在文件的第一个文档块中使用这个标记,则指定该文档块的余下部分将用来提供文件的一个概述。
@class                  提供类的有关信息,用在构造函数的文档中。
@constructor        明确一个函数是某个类的构造函数。
@type                  指定函数的返回类型。
@extends             指示一个类派生了另一个类。通常JSDoc自己就可以检测出这种信息,不过,在某些情况下则必须使用这个标记。
@private              指示一个类或函数是私有的。私有类和函数不会出现在HTML文档中,除非运行JSDoc时提供了—private命令行选项。
@final                  指示一个值是常量值。要记住JavaScript无法真正保证一个值是常量。
@ignore JSDoc    会忽略有这个标记的函数。

//一个示例配置文件,对example/aTest.js文件建立文档,结果输出在output文件夹里面。

{
	// source files to use.文件夹或文件数组,不支持正则表达式
	_: ["example/aTest.js"],
	
	// document all functions, even uncommented ones
	a: false,
	
	// including those marked @private
	p: false,
	
	// some extra variables I want to include
	D: {generatedBy: "shawn", copyright: "2010"},
	
	// use this directory as the output directory
	d: "output",
	
	// use this template
	t: "templates/jsdoc"
}

/**什么都没有定义,将作为全局变量
 * globle namespace
 <b>同样支持HTML标签</b>
 [list][*]111
[*]222
[*]333
[/list]

 */
var shawn2 = {};

/**
*   用 @class,表示这是一个类。
	下面的两个方法将被视为 static方法
	@class 工具
*/
shawn2.util = {
	/**
	* 去除空格
	@param {String} str	 
	*/
	trim:function(str){},
	/**
	* 格式化
	@param {String} fmt	 
	*/
	format:function(fmt){}
};


/**
 * 必须用 @constructor 声明这是一个构造函数。
 * @class
 * @constructor
 * @param {Object} cfg
 */
shawn2.Calendar = function(cfg){
    this.cfg = cfg;
    this.name = cfg.name;
    this.id = cfg.id;
}
/**
* something
*/
shawn2.Calendar.prototype={
    /**
     * default type
     * @static
     * @type Number
     */
    defaultType: 1,
    /**
     * CSS 
     * @static 
     * @type String
     */
    cssStyle:'plain',
    /**
     * init
     */
    init:function(){},
	/**
	 * getValue
	 * @public
	 * @param {Number} type type
	   @static
     * @return 
			type =1,return A;type=2,return B
	 */
    getValue:function(type){
    }
}

截图:

jsdoc使用_第1张图片

jsdoc使用_第2张图片

jsdoc使用_第3张图片

你可能感兴趣的:(JavaScript,html,css,正则表达式,ext)