Friday, January 16, 2009

Linking JavaDoc from Confluence

If you hadn't yet noticed, our Plugin Development documentation got a major boost recently with new topics and more detailed descriptions.
Today the documentation got links to online openAPI JavaDoc.

It seems there is no generally available solution for the JavaDoc links in Confluence, so here is a description of our approach.
The links were accomplished via Confluence User Macros

Now when a Confluence wiki markup looks like:
{tc-javadoc:jetbrains.buildServer.serverSide.SBuildServer|findBuildInstanceById(long)}
it is turned into a link: jetbrains.buildServer.serverSide.SBuildServer#findBuildInstanceById(long).

The User macro is:

#if ($param1)
#set ($methodRef = "#$param1")
#else
#set ($methodRef = "")
#end
<b><a href="http://javadoc.jetbrains.net/teamcity/openapi/current/${param0.replaceAll('\.','/')}.html$methodRef">$param0$methodRef</a></b>

Additional macro options:
Macro has a body: OFF
Output: Macro generates HTML markup

This is macro's first and quick version, it will probably be enhanced along the way.