Parsing wiki content

Jun 19, 2012 at 7:42 AM

Hi,

I have a requirement wherein I have to parse wiki content returns from Media Wiki APIs. 

I would like to know if WikiPlex.Parser class could be used for the same. If so can you please sample code with me.

 

Query to get wiki content would be something like this:

/w/api.php?action=query&prop=revisions&format=xml&rvprop=content&rvlimit=1&redirects=&titles=List%20of%20companies%20of%20India

Thanks,

Ashwin

Coordinator
Jun 24, 2012 at 5:16 PM

The renderers are fairly "open" to allow you to do what you need. You may either need to create your own, or provide your own renderers that override existing behavior. Check out the documentation on how to do this.

Apr 30, 2014 at 9:40 PM
I guess the biggest challenge is proper support for templates, which seems to be missing. Something like this:

{{IAmATemplate}}

Is taken as inline code, as is the codeplex variation on wikitext. But on mediawiki, this should be parsed as a template and properly expanded. WikiPlex seems to be missing this (or similar) functionality completely.

On top of that, the fact that WikiPlex relies on regular expression for """lexing""" wikitext, is absurd and allows for only very restrictive expansion. Templates would be extremely challenging if not impossible, using regexes.

My take on this is that so long as WikiPlex doesn't have a proper lexer, it won't get out of its puberty and allow for support of templates, and parsing MediaWiki text by extension, given MediaWiki has reached full adulthood since quite a while. Just saying.
Coordinator
Apr 30, 2014 at 9:49 PM
Agreed on all accounts. I'd recommend using a different solution then, as it seems that WikiPlex will not work for what you're wanting. It's been over a year since anything meaningful was added, and it is very unlikely that anything meaningful will be added in the future. WikiPlex was built for CodePlex, and without knowing the roadmap of CodePlex going forward, I can't say anything additional is needed to support that - in fact, I'd guess that its usage would be abandoned prior to adding anything new.
May 1, 2014 at 9:41 AM
Edited May 1, 2014 at 9:42 AM
A little odd to get that from a coordinator, but thanks for your honesty ;)