2013-02-20 21 views
5

我想添加一個customTag到jsdoc。我創建這樣的插件目錄中的文件:如何在jsdoc上添加和使用標籤?

method.js

exports.defineTags = function(dictionary) { 
    dictionary.defineTag("methodHttp", { 
     mustHaveValue: true, 
     canHaveType: false, 
     canHaveName: true, 
     onTagged: function(doclet, tag) { 
      doclet.methodHttp = tag.value; 
     } 
    }); 
}; 

然後我說我conf.json

{ 
    "tags": { 
     "allowUnknownTags": true 
    }, 
    "source": { 
     "includePattern": ".+\\.js(doc)?$", 
     "excludePattern": "(^|\\/|\\\\)_" 
    }, 
    "plugins": [ "plugins/method" ], 
    "templates": { 
     "cleverLinks": false, 
     "monospaceLinks": false, 
     "default": { 
      "outputSourceFiles": true 
     } 
    }, 
    "jsVersion": 180 
} 

現在我試着在我的模板上得到這個。我在method.tmpl上。

我想:

self.find('methodHttp')[0] 
data.methodHttp[0] 
data.methodHttp 

但它不工作。我的代碼有什麼問題?

回答

4

jsDoc.defineTag不支持標籤大寫字符...

雖然它似乎是在他們的字典中的錯誤!