1 (edited by mikepurvis 2005-09-01 15:48)

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.

Re: Wikitags for BBCode

On that, I have a small question : any idea what regexp would recognize a [[xx]] "tag"?

I'm trying to build a wiki tag using the wikiname syntax ([[name]]) but I'm always getting parsing errors sad

Re: Wikitags for BBCode

You should be able to modify this: Wikipedia markup...?

Re: Wikitags for BBCode

Thanks, this is the thread I was looking for, but wasn't able to find again sad

Re: Wikitags for BBCode

I had a hard time with that myself.