Well it would but first things first… VERY nice. I really like the DominoWiki – the wiki is really easy to install, configure and work with. I think I’ll introduce the other guys at the office to the concept.
|
After proper credit has been given let me get back to the initial focus of the post. The wiki should mainly be used to share code examples within my team of developers but I like code to look like code which it doesn’t when you just paste it into DominoWiki.
My first and obvious problem was that all datatypes showed up as WikiWords. This is understandable due to their CamelCase nature. The fix was easy though – enclose all code in the <nowiki> tag which basically tells DominoWiki not to parse the text. Nice.
This a new problem emerged – the code was displayed using the same font as the rest of the text. This made it hard to read and see what was introduction and what was code. Hmmm… Using the <code> HTML tag inside the <nowiki> tag helped me there. I now had nice Courier formatted code.
But wait a minute… Didn’t Julian Robichaux do a script library for converting LotusScript code into HTML so it would display on the web like it does in the Domino Designer. Well I believe he did. ๐
I went and fetched the code and hacked a little at the WikiPage.class script library. Now I can embed the <lotusscript> tag inside a <nowiki> tag and have nice formatted LotusScript in my wiki.
<nowiki>
<lotusscript>
Some LotusScript code...
</lotusscript>
</nowiki>
Really nice if I have to say so myself.
|

(Click image to open a bigger version)
|
Below is the patched version of the wikiFormat method from the WikiPage.class script library (remember to also get the ls2html script library from http://www.nsftools.com (I had to make small tweaks to the library to make it compile under Notes 6.5.4). The code has been formatted with ls2html – what else… ๐
.lotusscript { font-family: courier; font-size: 9pt; color: black; }
.ls-comment { color: green; }
.ls-quote { color: black; }
.ls-datatype { color: black; }
.ls-operator { color: blue; }
.ls-keyword { color: blue; }
.ls-statement { color: blue; }
.ls-function { color: blue; }
.ls-class { color: black; }
.ls-constant { color: purple; }
Public Function wikiFormat (txt As String) As String
Dim s1 As String, s2 As String, s3 As String, s4 As String
Dim a1 As Variant
Dim i As Integer
Dim pos As Long
Dim style As StyleDef
Const NOWIKI_START = "&lt;nowiki&gt;"
Const NOWIKI_END = "&lt;/nowiki&gt;"
Const LS_START = "&lt;lotusscript&gt;"
Const LS_END = "&lt;/lotusscript&gt;"
Call GetDefaultLsStyleDef(style)
style.script = "font-family: courier,sans-serif; font-size: 9pt; color: black;"
s1 = parseLinefeeds(txt)
s1 = removeHTML(s1)
a1 = Split(s1, NOWIKI_START, -1, 5)
For i = 0 To Ubound(a1)
If (i = 0) Then
s1 = a1(i)
s2 = ""
Else
pos = Instr(1, a1(i), NOWIKI_END, 5)
If (pos > 0) Then
s1 = Mid(a1(i), pos + Len(NOWIKI_END))
s2 = Left(a1(i), pos - 1)
Else
s1 = ""
s2 = a1(i)
End If
End If
s1 = parseWikiWords(s1)
s1 = parseLists(s1)
s1 = parseRules(s1)
matchCondition = "*"
matchCriteria = True
s1 = parseBold(s1)
s1 = parseItalics(s1)
s1 = parseHeaders(s1)
s1 = parseMonospace(s1)
s1 = parseBrackets(s1)
s3 = s3 & s2 & s1
Next
a1 = Split(s3, LS_START, -1, 5)
For i = 0 To Ubound(a1)
If (i = 0) Then
s4 = s4 & a1(i)
Else
pos = Instr(1, a1(i), LS_END, 5)
If (pos > 0) Then
s1 = Mid(a1(i), pos + Len(LS_END))
s2 = Left(a1(i), pos - 1)
Else
s1 = ""
s2 = a1(i)
End If
s2 = ConvertStringEx(s2, style, False)
s4 = s4 & s2 & s1
End If
Next
s3 = s4
s3 = fixAmp(s3)
s3 = fixRelativeLinks(s3)
s3 = allowSafeHTML(s3)
s3 = parseParas(s3)
wikiFormat = s3
End Function