[Mediawiki-l] Parsing wikitext for a separate PHP application

jonny Linux jonnylinux at gmail.com
Wed Feb 11 09:47:09 UTC 2009


Hi,

Sorry if this is the wrong place to ask this question, it's not
specifically about a mediawiki extension.

I'm writing a program for a separate PHP project, and I'd like to
parse wikitext into HTML. I've looked at the Alternative Parsers page
on mediawiki.org, but I'd like to know if it would be possible to use
some of the existing mediawiki PHP classes to parse the wikitext.

I was just wondering what the simplest code would be to convert from
wikitext into HTML. I've been looking at using Parser.php, but I think
I then need to include some other files. I've tried the following
code:

<?php
include("Parser.php");
include("GlobalFunctions.php");
$myparse = new Parser();
$linking = $myparse->parse("Hello ''there''");
echo $linking->getText();

?>

but I got "This file is part of MediaWiki, it is not a valid entry
point". So I assume I can't just create an instance of the Parser
class without including some other mediawiki classes.

Can anybody suggest how I can use the Parser class on its own (or with
as few other classes as possible)?

Thanks,

Jonny



More information about the MediaWiki-l mailing list