Friday, March 12, 2004 8:53 AM
pdbartlett
FlexWiki and Doxygen/NDoc
[UPDATE: I have now re-read the FAQ (properly this time ;) and found the "correct" answers to the problems. You can use a two double quotes before and after the text to prevent any default formatting, including the conversion of CamelCasedWords to topic links, and a "textism" format of "link text (optional tooltip)":url (e.g. "back at the dojo":http://blogs.geekdojo.net) to get aribitary links. However, this way was much more fun...]
I have recently raved about FlexWiki, but yesterday I came across two problems:
- class names are CamelCased, so it was turning them into prospective topics, but I didn't want the wiki-based documentation to go into that much detail
- I wanted to link in existing Doxygen-generated HTML documentation, but FlexWiki support for hyperlinks seems to be limited to just automagically converting anything it recognises as a URL
My first thought for problem (1) was that FlexWiki allows you to turn non-CamelCased text into a topic link by enclosing it in square brackets, so perhaps doing the same to CamelCased text would have the opposite effect. Alas, this did not work, so I resigned myself to putting up with the existing behaviour until I had time to look at the source in a bit more detail.
However, as soon as I turned my attention to the second issue, the two problems suddenly became an oppurtunity. FlexWiki allows you to link to other wikis with the syntax LinkTopic@otherWiki where otherWiki is a named reference to a URL pattern, e.g. @flexWiki=http://www.flexwiki.com/default.aspx/$$$. The pattern is "resolved" by subsituting the topic name for the $$$ sequence. All I now had to do was make the Doxygen documentation available in a compatible way. That was trivially done with the following ASP.NET handler (.ASHX file):
<%@webhandler class='DoxyClasses' language='c#'%>
using System;
using System.Web;
public class DoxyClasses : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
string strClassName = ctx.Request["className"];
if (strClassName.Length == 0)
{
ctx.Response.Write("No class name specified");
return;
}
ctx.Response.Redirect("/Doxygen/classXXX_1_1" + strClassName + ".html");
}
public bool IsReusable { get { return true; } }
}
Now, I doubt many of the readers of this blog use Doxygen (correct me if I'm wrong...), so I thought out of the kindness of my heart I'd knock up something similar for NDoc:
<%@webhandler class='NDocClasses' language='c#'%>
using System;
using System.Web;
public class NDocClasses : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
string strClassName = ctx.Request["nameSpace"];
string strClassName = ctx.Request["className"];
if (strClassName.Length == 0)
{
ctx.Response.Write("No class name specified");
return;
}
if (strNameSpace.Length > 0)
strNameSpace += '.';
ctx.Response.Redirect("/NDoc/" + strNameSpace + strClassName + ".html");
}
public bool IsReusable { get { return true; } }
}
You'll obviously need to play with the URLs a bit, but then all you need to do is add a line such as the following to the top of your wiki text:
@WhatbiClasses=http://MyServer/NDocClasses.ashx?nameSpace=Pdbartlett.Whatbi.Core&className=$$$
and then you can use topic links such as CDataSource@WhatbiClasses within your wiki text.
Happy wiki-ing!!!