Hello,
This is a frequent question and one I don't think I've ever explained
adequately, so thank you for asking it. (I think I will create a wiki
page on this topic, based on this post in the future.)
There are two parts to using custom tags. The first part is easy:
adding the custom tag to your doclet. For example if you wanted to
use a @flavor tag, simply go ahead and do so.
/**
* @constructor
* @flavor chocolate
*/
function IceCream() {
}
The second part can be as simple or complex as you wish to make it:
displaying the custom information in your output. This requires you
to handle the custom tag information in your template.
NOTE: This part is different from version 1 to version 2, but you
asked about version 1.4 so I'll give examples that will work with
version 1, using the "sunny" template.
<h2>Flavors</h2>
<ul>
<for each="flavor" in="thisClass.doc.getTag('flavor')">
<li>{+ flavor +}</li>
</for>
</ul>
Notice that I must treat the result of getTag() as an array. Even if
you only have one of a tag, it's possible you might later decide to
have two or more of those tags in a single doclet. For that reason
getTag() always returns an array, sometimes it just happens to be an
array of one.
If you want to ignore multiple tags, you can only use the first one:
<if "thisClass.doc.getTag('flavor').length > 0">
Flavor: {+ thisClass.doc.getTag('flavor')[0] +}
</if>
That is a very brief introduction but should get you started. Feel
free to ask more specific questions if you need to.
Regards,
Michael
On 25 Apr 2008, at 10:30, mou...@gmail.com wrote:
> I was curious, can you please provide me guidance as to how I would
> add a custom tag to the toolkit v 1.4?
> I'd like to add a few custom tags that are used in my code, including
> '@todo' which specifies functions that need more completion etc.
> thanks