add a code tag into wiki pages using some regex and the pre tag in a custom Mediawiki extension:
< = <
> = >
[ = [
] = \
its for displaying code and such like below, but with outthe messing about
this is a first untestedversion with justmonkey knolage of how to make it work
Syntax
<code>text</code>
Example
<code>moo</code>
example Result
| '_ ` _ \ / _ \ / _ \ | | | | | | (_) | (_) | |_| |_| |_|\___/ \___/
Source
<?php # code Mediawiki extension # using regex # by DrOwl 21.06.2005 <- a Date in the Future ,ehe ;) #modded from # by mutante 25.03.2005 #install extension hook $wgExtensionFunctions[] = "wfCodeExtension"; #extension hook callback function function wfCodeExtension() { global $wgParser; #install parser hook for <code> tags $wgParser->setHook( "code", "renderCode" ); } function renderCode( $input ) { global $wgOutputEncoding; # $input = mysql_escape_string($input); if (!$input) $input = "mu"; #ifno input then mu $input =~ s/&/&/g; $input =~ s/</</g; $input =~ s/>/>/g; $input =~ s/[/[/g; $input =~ s/]/\/g; $output="<pre>"; $output."$input"; $output.="<nowiki>
</nowiki>";
return $output;
}
?>