OpenWiki

Open Wiki/Extensions/Prettier Links



Edit this page (last edited May 23, 2004)
Open Wiki | Sand Box | Create Page | User Preferences | Recent Changes | Title Index | Random Page | Find Page | Help
» Sand Box » Open Wiki/Extensions/Prettier Links

You can make the links even prettier, so that words with one letter and acronyms such as HTML can be used. For example, the wiki word ThisIsAPageAboutHTMLAndXML? would be displayed as 'This Is A Page About HTML And XML '

In owwikify.asp, replace the function 'PrettyWikiLink?' with the following. Note, only one line has changed from the original.

Function PrettyWikiLink(pID)
    If cPrettyLinks Then
        PrettyWikiLink = s(pID, "([a-z\xdf-\xff0-9])([A-Z\xc0-\xde]+)", "$1 $2", False, True)
        PrettyWikiLink = s(PrettyWikiLink, "([A-Z\xc0-\xde]+)([A-Z\xc0-\xde]+)([a-z\xdf-\xff0-9])", "$1 $2$3", False, True)
    Else
        PrettyWikiLink = pID
    End If
    If cFreeLinks Then
        PrettyWikiLink = Replace(PrettyWikiLink, "_", " ")
    End If
End Function

DanielFlippance?


Function PrettyWikiLink(pID)
    If cPrettyLinks Then
        PrettyWikiLink = s(pID, "([a-z\xc0-\xde])([A-Z\xc0-\xde]+)", "$1 $2", False, True)
        PrettyWikiLink = s(PrettyWikiLink, "([0-9])([A-Z\xc0-\xde])([a-z\xc0-\xde])", "$1 $2$3", False, True)
        PrettyWikiLink = s(PrettyWikiLink, "([A-Z\xc0-\xde])([a-z\xc0-\xde]+)([0-9])", "$1$2 $3", False, True)
        PrettyWikiLink = s(PrettyWikiLink, "([A-Z\xc0-\xde]+)([A-Z\xc0-\xde]+)([a-z\xc0-\xde]+)", "$1 $2$3", False, True)
    Else
        PrettyWikiLink = pID
    End If
    If cFreeLinks Then
        PrettyWikiLink = Replace(PrettyWikiLink, "_", " ")
    End If
End Function

I've added (and modified) a few rules to make it even "prettier" when there are numbers inside the Wiki names. e.g.

Hope that I've covered most of the combinations that are meaningful...

Ng Ming Hong (23 May 2004)


Open Wiki | Sand Box | Create Page | User Preferences | Recent Changes | Title Index | Random Page | Find Page | Help
Edit this page | View other revisions
Print this page | View XML
Find page by browsing, searching or an index
Edited May 23, 2004 (diff)




Valid XHTML 1.0!Valid CSS!

Powered by OpenWiki.com