JSDoc-toolkit中的自定义标记

时间:2011-02-11 10:22:48

标签: javascript jsdoc

您好 我正在尝试将自定义标记添加到JSDoc-toolkit。我找到的唯一有用的网站是:Using custom tags但它不起作用。

我也试过{+data.comment.getTag("customTag")[0]+}而没有运气。

1 个答案:

答案 0 :(得分:5)

我正在将它用于@TODO标签并且有效。这是一个例子:

/**
 * Working with cookies (set/get/delete)

 * @namespace Cookies related methods
 * @TODO serialize javascript object and store in cookie
 */
x.cookie = x.cookie || {};

/**
 * Set cookie with name/value and expiration with one year
 * 
 * @param {string} name
 * @param {string} value
 * @TODO write this method 
 */
x.cookie.set    = function(name, value) {

};

您可以在默认模板中添加第一个@TODO,如下所示:

<!-- ============================== ToDo summary ======================== -->
            {!
                var todos = data.comment.getTag("TODO");
            !}
            <if test="todos.length">
                <table class="summaryTable" cellspacing="0" summary="A summary of the TODOs documented in the class {+data.alias+}.">
                    <caption>TODO Summary</caption>
                    <thead>
                        <tr>
                            <th scope="col"></th>
                            <th scope="col">ToDo Description</th>
                        </tr>
                    </thead>
                    <tbody>
                    <for each="todo" in="todos">
                        <tr>
                            <td class="attributes">

                            </td>
                            <td class="nameDescription">
                                {+todo+}
                            </td>
                        </tr>
                    </for>
                    </tbody>
                </table>                
            </if>

和第二个,对于每种方法:

<if test="member.comment.getTag('TODO')[0]">
    todo: {+ member.comment.getTag("TODO")[0] +} 
</if>