[Jsdoc-user] Fwd: adding code sample/snippet to jsdoc
Status: Inactive
Brought to you by:
mmathews
From: Michael M. <mi...@gm...> - 2007-03-02 07:40:15
|
Hi, Gabriel can answer for JSDoc 1.x but because JSDoc-2 doesn't pick and =20= choose which tags it will process, you very well could invent an =20 @example tag. In that case the example text would be passed into the =20 template as-is. If your template produced HTML, then there is nothing to stop you =20 from having any HTML tags you wanted in the body of your example tag. =20= In JSDoc-2 your tag could look like this: /** nlapiCreateRecord - Initializes a new record and returns an nlobjRecord containing all the default field data for that record type @param type - record type for the record @example The following example initializes a new opportunity record. <code> var record =3D nlapiCreateRecord('opportunity') var defaultstatus =3D record.getFieldValue('entitystatus') </code> */ function nlapiCreateRecord(type) { ; } But we are still developing JSDoc-2. When the first beta is released =20 (any day now!) I'll include an example of how to write a template to =20 handle example tags. Regards, Michael > > On 1 Mar 2007, at 23:07, Rodrigues, Kate wrote: > >> Hi there =96 >> >> >> In my JavaScript file, is there a javadoc tag I can use to set off =20= >> a small, illustrative code snippet? Is there anything like an =20 >> @example tag I can put in front of the code snippet to set the =20 >> sample code apart from the function description? Also, bordering =20 >> the code sample do I need to have <code></code> tags so that the =20 >> text will appear in code format? >> >> >> For example: >> >> >> /**Initializes a new record and returns an nlobjRecord containing =20 >> all the default field data for that record type >> >> *@param type record type for the record >> >> *@example the following example initializes a new opportunity record >> >> *<code>var record =3D nlapiCreateRecord('opportunity')</code> >> >> *<code>var defaultstatus =3D record.getFieldValue('entitystatus')</=20= >> code> >> >> */ >> >> function nlapiCreateRecord(type) { ; } >> >> >> >> Many of the developers around here like the output of JSDoc, but =20 >> they want the output to capture a lot of things I just don=92t know =20= >> how to add yet, like code samples imbedded/commented within the code. >> >> >> Thanks! >> >> kate >> >> ---------------------------------------------------------------------=20= >> ---- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to =20 >> share your >> opinions on IT & business topics through brief surveys-and earn cash >> http://www.techsay.com/default.php?=20 >> page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV___________________________= ____=20 >> ________________ >> Jsdoc-user mailing list >> Jsd...@li... >> https://lists.sourceforge.net/lists/listinfo/jsdoc-user > |