Friday, April 16, 2004

NDoc, the best and free documentation compiler for C# has lately released v1.3. This version adds a very interresting new feature: custom tags.Basically, you just need to provide the XSLT templates to NDoc and it use them to render you tags: simple, efficient and highly customizable.

In the NCollection project, we needed a way to easily document the complexity of methods (average and worst). A custom tag was the perfect solution for that: (hint: I'm using brackts intead of minus/greater)

/// [complexity worst="n" average="1" /]
public void Method()
{...}

Starting from the NDoc example, the XSLT stylesheet to render this tag is:

[xsl:template mode="remarks-section" match="complexity">
[H4 class=dtH4>Complexity[/H4]
    [UL]
        [LI]Average: O([xsl:value-of select="@average"][/xsl:value-of])
        [LI]Worst-case: O([xsl:value-of select="@worst"])[/LI]
    [/UL]
    [xsl:apply-templates select="*"/]
[/xsl:template]

Et voilà!

posted on Saturday, April 17, 2004 2:34:00 AM UTC  #    Comments [1]
Tracked by:
"diovan" (online) [Trackback]
Monday, June 06, 2005 6:15:37 PM UTC
Hi,
<br>I maked my own history class tag that handle version, programer and date for each event.
<br>
<br>In code :
<br>///&lt;history&gt;
<br>///&lt;log programer=&quot;Programer's name&quot;
<br> date=&quot;11 f&#233;vrier 2005&quot;
<br> version=&quot;1.0&quot;&gt;
<br>///&lt;event&gt;bug #666 resolved...&lt;/event&gt;
<br>///&lt;event&gt;minor user interface modifcations...&lt;/event&gt;
<br>///&lt;/log&gt;
<br>/// ...
<br>///&lt;/history&gt;
<br>
<br>XSLT file template :
<br>&lt;xsl:template match=&quot;history&quot;
<br> mode=&quot;seealso-section&quot;&gt;
<br>&lt;H4 class=&quot;dtH4&quot;&gt;History&lt;/H4&gt;
<br>
<br>&lt;ul type=&quot;disc&quot;&gt;
<br>&lt;!-- Loop throw each log --&gt;
<br>&lt;xsl:for-each select=&quot;log&quot;&gt;
<br> &lt;li&gt;
<br> v&lt;xsl:value-of select=&quot;@version&quot;/&gt; -
<br> &lt;xsl:value-of select=&quot;@programer&quot;/&gt;
<br> (&lt;xsl:value-of select=&quot;@date&quot;/&gt;)
<br> &lt;br /&gt;
<br>
<br> &lt;ul&gt;
<br> &lt;!-- Loop throw each event --&gt;
<br> &lt;xsl:for-each select=&quot;event&quot;&gt;
<br> &lt;li&gt;
<br> &lt;xsl:value-of select=&quot;.&quot;/&gt;
<br> &lt;/li&gt; &lt;/xsl:for-each&gt;
<br> &lt;/ul&gt;
<br> &lt;/li&gt;
<br>&lt;/xsl:for-each&gt;
<br>&lt;/ul&gt;
<br>&lt;/xsl:template&gt;
<br>
<br>Met &#231;a dans ta pipe pis fume toi ! ;)
le_mulot
Comments are closed.