Topic: Wikitags for BBCode
I guess this is technically a "mod" question, but it's really just a regex question.
I want the following tags:
[wiki=Main Page]foo[/wiki]
[wiki=Main_Page]foo[/wiki]
[wiki]Main Page[/wiki]
[wiki]Main_Page[/wiki]
To all become links pointing to "/wiki/Main_Page"
So far I've modified the do_bbcode function in parser.php, and added these rules:
'#\[wiki\](.*?)\[/wiki\]#' -> '<a href="/wiki/$1" class="wikilink">$1</a>'
'#\[wiki=(.*?)\](.*?)\[/wiki\]#' -> '<a href="/wiki/$1" class="wikilink">$2</a>'
Is there some easy way to have it always convert underscores to spaces and vice-versa (depending on whether it's in the link or the label), without throwing an addition regex on there?
Thanks.