[Mediawiki-l] Multiple Parsing Stages / Parsers

Hinnerk Bruegmann h.bruegmann at googlemail.com
Wed Nov 1 12:44:55 UTC 2006


Greetings,

I am using MediaWiki for gathering and structuring content for a
research project and am trying to implement a customized version of the
BibTex extension
http://gsc2.cemif.univ-evry.fr/index.php/Mediawiki_extensions#Bibtex_extension

Basically the extension (called via a custom <citetex> tag) takes input
from a template, processes the BibTex information found there and
outputs a book/article reference. Some of that information (like author
names) shall be processed as wikitext (e.g. to link to the author page
inside the Wiki). 
It shall be possible for the <citetex> tag to occur multiple times on a
page referencing different "source-templates".

Using the parser object passed to the extensions render function:

	function renderCiteBook( $input, $argv, &$parser) {
	// do some processing of the input here -> $string
	$localOutput = $parser->parse($string, $parser->mTitle,
$parser->mOptions, false);
	$output .= $string->getText();
	}

results in all but the last <citetex> instance to be output as an UNIQ
object.

Following the instructions on
http://meta.wikimedia.org/wiki/MediaWiki_extensions_FAQ#How_do_I_render_wikitext_in_my_extension.3F
(that is creating a new local parser object inside the render-function
and using the parse() method of that instance) solved this problem and
wikitags are now parsed correctly.
What this approach does not accomplish, is creating the appropriate
wiki-references (no exact idea how they are created and stored in the
wiki-db) so "whatlinkshere" and "wanted pages" etc. don't work for
content/links parsed in this way.

So: do you have an idea or suggestion on how to get the backlinks etc.
references working also for wiki-links created by an extension?

Thanks alot for your help,
Hinnerk

 
	





More information about the MediaWiki-l mailing list