On Sat, 16 Oct 2004 17:02:16 +0200, Felix Damrau mail@felixdamrau.de wrote:
Dear subscribers,
I want to add a new wiki-tag to my mediawiki. I thought that is quite easy but I a too stupid for that.
Well, I'm afraid there *is* no easy way with the current state of the software. The file you need to "play with" is includes/Parser.php (which is not, technically, a "parser").
The wiki Tag shoulb be like this:
I write: >>> text here <<< blabla. The three ">>>" shall word like the tags for emphasize. Where can I add now tags? Which files have to be edited? Can I format the text between the ">>>" Tags?
It would be great if there would be a starting tag <div id="bla"> and an ending Tag </div>
I was wracking my brains trying to think of an example where there isn't all sorts of special handling code in with the regular expressions which are essentially all the "parser" consists of. And then I came upon this function, apparently never called; create something like this, actually call it from somewhere like internalParse() [be careful with what gets processed before or after it]; do plenty of testing (there's a maintenance/parserTests.php which you can run; make sure you create an AdminSettings.php first); and Bob may very well be your uncle...
function doExponent ( $text ) { $fname = 'Parser::doExponent'; wfProfileIn( $fname); $text = preg_replace('/^^(.*)^^/','<small><sup>\1</sup></small>', $text); wfProfileOut( $fname); return $text; }
Come to think, that's not so hard after all - although I don't guarantee it will really be as simple as that.