[cl-wiki-devel] Wiki transforms
Ian Clelland
clelland at gmail.com
Wed Aug 31 23:48:10 UTC 2005
I don't know whether this will be considered useful or harmful, but I
got frustrated yesterday with my inability to create links to off-site
resources (other web sites, email addresses, etc), and to be able to
have the text of a hyperlink show anything other than the exact page
name. So, modelling things after Wikipedia, I've added the following
simple replacement patterns:
;; Allow pipe-separated page name and text description
("\\[\\[([^]\">|]*?)\\|([^]\">]*?)\\]\\]" . "<a href=\"\\1\">\\2</a>")
;; Standard [[ ]] wiki links
("\\[\\[(.*?)\\]\\]" . "<a href=\"\\1\">\\1</a>")
;; Use single [ ] for external links. Only allow the specified protocols
("\\[(http|ftp|mailto|gopher):([^\">].*?)\\]" . "<a class=\"external
\\1\" href=\"\\1:\\2\">\\1:\\2</a>")
(after getting rid of *wiki-url* in links, I moved the complex
wiki-linking code into simple-replace, and complex-translate does
nothing)
With these replacements, I can write wiki code like this:
You should really read [[OtherDocument|this other thing]].
Other information is available at this site: [http://www.example.com]
The addition of classes to external links let me visually distinguish
them with CSS, and there is deliberately no way for someone to make an
external link that looks like a wikilink, to prevent some of the more
heinous forms of wiki-spam.
Regards,
Ian Clelland
<clelland at gmail.com>
More information about the Cl-wiki-devel
mailing list