Question

Hi I have some custom wikitext(which also includes templates) and need to convert to html. The main issue is I can have any wikipedia template and most parsers dont do template expansion or need the templates to be downloaded before hand. Another complexity is the new Lua modules (eg Infobox module uses #invoke) which breaks some of the implementations. Here are a couple of things I tried:

  1. Tried the gwtwiki(bliki) software but the Lua modules are not supported and also there are some errors in html conversion of the wikitext.(It doesnt seem to be maintained actively)

    1. So are there any other software which can download templates(also Lua) through wiki api and parse wikitext effectively.

    2. I tried using revid while getting templates to get away with Lua modules but the gwtwiki is still failing. Are there any other libraries that do wiki api download of templates and store locally. And then convert to html.

  2. I have found the expandtemplates api call of mediawiki, but the (wiki)text to be converted is sent through the url get parameter and there is inherent limit to the size of text. Are there any post methods that does this conversion.

  3. Another thing I tried is to get the xml dump of whole wikipedia and replicate the pages/api/wiki with the mediawiki software. But importing the xml is a pain.

    1. Are there any guides to effectively do this.
    2. ALso the Lua plugin fails if I do a simple Special:Import in my wiki after I did a Special:Export of a article in wikipedia.
    3. After this import, the articles and modules exist in my sql dump but they donot seem to be linked. The buildall.php scripts takes forever.
Was it helpful?

Solution

All MediaWiki API queries that can be executed as GET requests can also use POST.

And I think the API module you want is action=parse. Something like:

URL: http://en.wikipedia.org/w/api.php
POST data: action=parse&text=your text

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top