I was just rethinking of this, and decided to check this topic again ... I was wondering if there was someone out there who has some idea's about how to build this ?
I've taken the ReplaceURL's code, and rebuild it for the function ReplaceAcrs (replace acronyms)
So, instead of using the title attribute I've switched to the acronyms entity instead.... I know it's wrong (it's not meant for this purpose) but the effect is very much similar...
)
Function ReplaceAcrs(ByVal strToFormat)
Dim oTag, c1Tag, c2Tag
Dim roTag, rc1Tag, rc12Tag, rc2Tag
Dim oTagPos, c1TagPos, oTagPos2, c1TagPos2
Dim Counter
Dim strArray, strArray2
Dim strFirstPart, strSecondPart
oTag = "[acr=*"
c1Tag = "*]"
c2Tag = "[/acr]"
roTag = "<acronym title="""
rc1Tag = """>"
rc2Tag = "</acronym>"
oTagPos = InStr(1, strToFormat, oTag, 1) 'Position of opening tag
c1TagPos = InStr(1, strToFormat, c1Tag, 1) 'Position of closing tag
'if opening tag and closing tag is found...
If (oTagpos > 0) And (c1TagPos > 0) Then
'Split string at the opening tag
strArray = Split(strToFormat, oTag, -1, 1)
'Loop through array
For Counter = 0 To UBound(strArray)
'if the closing tag is found in the string then...
If (InStr(1, strArray(Counter), c1Tag, 1) > 0) Then
'split string at the closing tag...
strArray2 = Split(strArray(Counter), c1Tag, -1, 1)
strArray2(0) = replace(strArray2(0), """", " ") ' ## filter out "
strArray2(0) = replace(strArray2(0), ";", " ", 1, -1, 1) ' ## filter out ;
strArray2(0) = replace(strArray2(0), "+", " ", 1, -1, 1) ' ## filter out +
strArray2(0) = replace(strArray2(0), "(", " ", 1, -1, 1) ' ## filter out (
strArray2(0) = replace(strArray2(0), ")", " ", 1, -1, 1) ' ## filter out )
strArray2(0) = replace(strArray2(0), "*", " ", 1, -1, 1) ' ## filter out *
strArray2(0) = replace(strArray2(0), "'", " ", 1, -1, 1) ' ## filter out '
strArray2(0) = replace(strArray2(0), ">", " ", 1, -1, 1) ' ## filter out >
strArray2(0) = replace(strArray2(0), "<", " ", 1, -1, 1) ' ## filter out <
strArray2(0) = replace(strArray2(0), vbTab, " ", 1, -1, 1) ' ## filter out Tabs
strArray2(0) = replace(strArray2(0), "view-source", " ", 1, -1, 1) ' ## filter out view-source
strArray2(0) = replace(strArray2(0), "javascript", " ", 1, -1, 1) ' ## filter out javascript
strArray2(0) = replace(strArray2(0), "jscript", " ", 1, -1, 1) ' ## filter out jscript
strArray2(0) = replace(strArray2(0), "vbscript", " ", 1, -1, 1) ' ## filter out vbscript
'if the closing url tag is found in the string and
'[URL] is not found in the string then...
If InStr(1, strArray2(1), c2Tag, 1) then
strFirstPart = Left(strArray2(1), InStr(1, strArray2(1), c2Tag, 1)-1)
strSecondPart = Right(strArray2(1), (Len(strArray2(1)) - Instr(1, strArray2(1), c2Tag,1) - len(c2Tag)+1))
If strFirstPart <> "" Then
If UCase(Left(strFirstPart, 5)) = "[IMG]" Then
ReplaceAcrs = ReplaceAcrs & "<acronym title=""" & strArray2(0) & """>" & strFirstPart & "</acronym>" & strSecondPart
Else
ReplaceAcrs = ReplaceAcrs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
End If
Else
ReplaceAcrs = ReplaceAcrs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strSecondPart
End If
Else
ReplaceAcrs = ReplaceAcrs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strArray2(1)
End If
Else
ReplaceAcrs = ReplaceAcrs & strArray(Counter)
End If
Next
Else
ReplaceAcrs = strToFormat
End If
End Function
This seems to work ok, with this syntax:
[acr=*Text of the acronym*]bla[/acr]
Now, the text bla is shown with the text Text of the acronym hovering over it with a mouseover.
I've decided to use the asterisk instead of the quote, to avoid conflicts with the ReplaceURLs function, where "] is replaces by </a>.<