YUIDoc Javascript Documentation Tool

有的时候,生活就像和你作对,你越想干的事情,越干不来,但不想干的事情,却老是找到你

                                                                                                                         --- chenhailong

 

好了,说上正题

官网:

http://yui.github.com/yuidoc/

 

官网上给了其安装的过程。

 

 

  1. Download and install Node.js
  2. Run npm -g install yuidocjs.
  3. Run yuidoc . at the top of your JS source tree.
我这里也是翻译。
1.下载Node.js : http://nodejs.org/#download
2.执行:   npm -g install yuidocjs(就是安装yuidocjs)
3.执行 "yuidoc ."

介绍YUIDoc的语法

module方式
/**
Provides the base Widget class...

@module widget
**/
main的方式
/**
Provides more functionality for the widget module..

@module widget
@submodule widget-foo
@main widget
**/

class的方式

 

/**
A utility that brokers HTTP requests...

@class IO 
@constructor
**/
function IO (config) {

 

method的方式

 

/**
Returns this model's attributes as...

@method toJSON
@return {Object} Copy of ...
**/
toJSON: function () {

 

event的方式

 

/**
Fired when an error occurs...

@event error 
@param {String} msg A description of...
**/
var EVT_ERROR = 'error',

 

property的方式

 

/**
Template for this view's container...

@property containerTemplate 
@type String
@default "<div/>"
**/
containerTemplate: '<div/>',

 

attribute的方式

 

 

/**
* Indicates whether this Widget
* has been rendered...
*
* @attribute rendered
* @readOnly
* @default false
* @type boolean
*/
ATTRS[RENDERED] = {

 

上面都是常用的方式和方法

 

具体的可以参考 http://yui.github.com/yuidoc/syntax/index.html

 

下面给出一个例子:

 

1.安装yuidoc

 

npm config set proxy=http://me.proxy:8080

 

npm -g install yuidocjs

2.加yuidocjs默认为系统集的path,如果没有,要手工添加

3.cd到指定到项目的project下

4.添加yuidoc.json

 

 

 

{
    "name": "Documenting JavaScript with YUIDoc",
    "description": "A tutorial about YUIDoc, for Nettuts+",
    "version": "1.0.0",
    "url": "http://net.tutsplus.com",
    "options": {
        "linkNatives": "true",
        "outdir": "docs",
        "paths": "."
    }
}
 

 

5.生成的文档会长docs中,执行 "yuidoc ."就会生成doc

 

下面给出source,希望对大家有帮助,不懂的站内信

 

 

 

 

 

 

你可能感兴趣的:(JavaScript)