Hi,
thanks for your Wiki, I like it very much. The only thing I missed was to mark a WikiWord by using brackets [ and ].
So I changed some code, perhaps you will build that into the next version :-)
Here are my changes:
Skript-library WikiPages.class:
Private Function parseWikiWord(aLine As String, aString As String) As String<br/>
'// Called by parseLine<br/>
Dim c As String<br/>
Dim i As Integer<br/>
Dim nrCaps As Integer<br/>
<br/>
If Len(aString) > 0 Then<br/>
%REM
If Instr(aString, ":") Then<br/>
Select Case Left(aString, Instr(aString, ":"))<br/>
Case "https", "http", "mailto", "ftp":<br/>
parseWikiWord = {<a href="} & aString &_<br/>
{">} & aString & {</a>}<br/>
End Select<br/>
Else<br/>
%END REM
c = Left(aString, 1)<br/>
' *** jbuss@youatnotes.de 5 nov 2004<br/>
If isUCase(c) Or c = "[" Then ' is the first letter UPPER-CASE or it s [<br/>
' *** end jbuss@youatnotes.de 5 nov 2004<br/>
nrCaps = 1 <br/>
For i = 2 To Len(aString)<br/>
c = Mid(aString, i, 1)<br/>
If isUCase(c) Then<br/>
nrCaps = nrCaps + 1<br/>
End If<br/>
Next<br/>
' *** jbuss@youatnotes.de 5 nov 2004<br/>
If (nrCaps > 1 And nrCaps <> Len(aString)) Or (Right(aString, 1) = "]") Then ' we have a WikiWord when we have a [someword]<br/>
' *** end jbuss@youatnotes.de 5 nov 2004<br/>
Dim dummyDoc As NotesDocument<br/>
Dim escaped As String<br/>
' *** jbuss@youatnotes.de 5 nov 2004: moved line "escape = .." some lines later<br/>
<br/>
'// Test whether wikiword is in an a link<br/>
If testLink(aLine, aString) Then<br/>
parseWikiWord = aString<br/>
Exit Function<br/>
End If<br/>
<br/>
' *** jbuss@youatnotes.de 5 nov 2004 <br/>
'// remove [ ] if present<br/>
If Left(aString,1) = "[" And Right(aString, 1) = "]" Then<br/>
aString = Right(aString, Len(aString)-1)<br/>
aString = Left(aString, Len(aString)-1)<br/>
End If<br/>
escaped = EscapeString(aString)<br/>
' *** end jbuss@youatnotes.de 5 nov 2004<br/>
<br/>
Select Case aString<br/>
Case "RecentChanges"<br/>
parseWikiWord = {<a href="/} & dbPath &_<br/>
{/} & escaped & {">} & aString & {</a>} <br/>
Case "BackLinks"<br/>
parseWikiWord = {<a href="/} & dbPath &_<br/>
{/} & escaped & {?Open&Link=} &_<br/>
EscapeString(strSubj) & {">} &_<br/>
aString & {</a>}<br/>
Case Else<br/>
Set dummyDoc = findWikiPage(aString)<br/>
If dummyDoc Is Nothing Then<br/>
parseWikiWord = aString & {<a href="/} &_<br/>
dbPath & "/" & FRM & "?OpenForm&Title=" &_<br/>
escaped & {" title="Create a wiki page for '} &_<br/>
escaped & {">?</a>}<br/>
Else<br/>
updateLinks escaped<br/>
parseWikiWord = {<a href="/} &_<br/>
dbPath & {/Pages/} &_<br/>
escaped & {">} &_<br/>
aString & {</a>}<br/>
End If<br/>
End Select<br/>
Exit Function<br/>
Else <br/>
parseWikiWord = aString<br/>
End If '// If nrCaps...<br/>
Else<br/>
parseWikiWord = aString<br/>
End If '// If IsUCase...<br/>
' End If '// If Instr….
Else <br/>
parseWikiWord = ""<br/>
End If '// If Len...<br/>
<br/>
End Function<br/>
Private Function isUCase(ch As String) As Integer<br/>
Dim a As Integer<br/>
<br/>
' **** jbuss@youatnotes.de 4 nov 2004<br/>
If ch = "[" Then <br/>
isUCase = True<br/>
Exit Function<br/>
End If<br/>
' **** end jbuss@youatnotes.de 4 nov 2004<br/>
<br/>
a = Asc(ch)<br/>
isUCase = (65 <= a) And (a <= 90)<br/>
End Function<br/>
<br/>
<br/>
Private Function isChar(ch As String) As Integer<br/>
Dim a As Integer<br/>
<br/>
' **** jbuss@youatnotes.de 4 nov 2004<br/>
If ch = "]" Or ch = "[" Then <br/>
isChar = True<br/>
Exit Function<br/>
End If<br/>
' **** end jbuss@youatnotes.de 4 nov 2004<br/>
<br/>
<br/>
If Len(ch) = 1 Then <br/>
a = Asc(ch)<br/>
isChar = (65 <= a) And (a <= 90) Or (97 <= a)_<br/>
And (a <= 122) <br/>
Else<br/>
isChar = False<br/>
End If<br/>
End Function<br/>
<br/>
<br/>
Private Function isLCase(ch As String) As Integer<br/>
Dim a As Integer<br/>
<br/>
' **** jbuss@youatnotes.de 4 nov 2004<br/>
If ch = "]" Then <br/>
isLCase = True<br/>
Exit Function<br/>
End If<br/>
' **** end jbuss@youatnotes.de 4 nov 2004<br/>
<br/>
a = Asc(ch)<br/>
isLCase = (97 <= a) And (a <= 122) Or (a = Asc("ü"))_<br/>
Or (a = Asc("ä")) Or (a = Asc("ö")) Or (a = Asc("&"))_<br/>
Or (a = Asc(";"))<br/>
End Function<br/>
Function testLink(content As String, testword As String) As Boolean<br/>
'// If one char to the left of the proposed WikiWord is NOT<br/>
'// a blank space, assume it's buried in a URL or similar &<br/>
'// therefore leave alone -- i.e. NO wiki mark-up<br/>
testLink = True<br/>
Dim v As Variant<br/>
Dim strval As String<br/>
Dim macro As String<br/>
<br/>
' *** jbuss@youatnotes.de 5 nov 2004<br/>
' make sure something with a starting [ is not threated as link<br/>
If Left(testword, 1) = "[" Then<br/>
testLink = False<br/>
Exit Function<br/>
End If<br/>
' *** end jbuss@youatnotes.de 5 nov 2004 <br/>
<br/>
'// if content contains double quotes, replace them with<br/>
'// single ones as doubles screw up Evaluate call<br/>
If Instr(content, {"}) > 0 Then<br/>
content = ReplaceSubString(content, {"}, "'")<br/>
End If<br/>
<br/>
macro = {@Right(@Left("} & content & {"; "} &_<br/>
testword & {"); 1)}<br/>
<br/>
v = Evaluate(macro)<br/>
strVal = v(0)<br/>
If strval = " " Then testLink = False<br/>
End Function<br/>