将Wiki标记转换为纯文本

Using Pear Wiki package, I tried using following code to convert some media wiki to plain text, but it does not work as expected. What is wrong with it?

require_once "Text/Wiki/Mediawiki.php";
$p=new Text_Wiki_Mediawiki();

echo $p->transform('==a title==[[ a link]]','plain');

// I expect "a title a link" but it returns: "==a title==[[ a link]]"

Oh, this package built path to class dynamically and throw no exception. In addition to PEAR Text_Mediawiki package you should also get core PEAR packages and add its path to include_path.

Header declarations in the media wiki markup have to be on separate lines, so the following will work:

<?php
require_once "Text/Wiki/Mediawiki.php";
$p=new Text_Wiki_Mediawiki();

echo $p->transform("==a title==
[[ a link]]","plain");