MediaWiki 2 TWiki Conversion Tool

Powered by
WikiRing Consultants

This is a commandline tool to import MediaWiki pages and images to TWiki. It processes a MediaWiki XML dump to extract the pages and thus does not need a database access once the dump was created.

The conversion tool takes care of almost all peculiarities of MediaWiki and TWiki. It does not map MediaWiki's category system onto TWiki as long as TWiki lacks a standard category system. There are however many ways to implement categories in TWiki, one of which is the upcomming ClassificationPlugin which implements true hierarchies and semantic predicates to query categories and topics within. The mediawiki2twiki tool allows to map the MediaWiki categories onto any TWiki category system like the mentioned one using a plugin interface that comes with the conversion tool.

One notion of caution: in general the conversion tool is able to convert the wiki markup dialects. However, the MediaWiki's template mechanism, comparable to TWiki's parametrized INCLUDE statement does not match. The reason is burried in the different parsing priorities within both parsers: while MediaWiki parses left-to-right, TWiki does also parser inside-out, which means parameters to INCLUDE are evaluate before making the inclusion. The opposite is the case in MediaWiki. In a way MediaWiki's tempaltes are called "by reference" (passing the unparsed parameters) while TWiki evaluates INCLUDE passing parameters "by value". This means, that WikiApplications written for MediaWiki won't be translatable to TWikiApplications easily by this tool.


The conversion tool is in <path-to-your-twiki>/tools/mediawiki2twiki.


             --file <dumpfile>
             [--<defaultweb> <webname>]
             [--<exclude> <regex>]
             [--<images> <path>]
             [--<include> <regex>]
             [--<language> <language code>]
             [--<match> <regex>]
             [--<max> <number>]
             [--<namespace> <name>]
             [--<plugin> <perlfile>]
             [--<topicmap> <fromTopic1=toTopic1,fromTopic2=toTopic2,...>]
             [--<web> <target web>]
             [--<webmap> <fromWeb1=toWeb1,fromWeb2=toWeb2,...>

Example call

             --file dump.xml
             --web MediaWiki
             --language de
             --topicmap 'Hauptseite=WebHome,Spezial.Allpages=WebTopicList'
             --images /var/www/mediawiki/images
             --defaultweb _mediawiki_default
             --plugin MyConversionPlugin
             --exclude '^(MediaWiki|Bild|Kategorie):'

This reads the file dump.xml, and creats a TWiki web called MediaWiki in our current TWiki installation (see Setup). In this example, the source content is German. The pages "Hauptseite" will be stored in the the WebHome topic. The Special.Allpages page will be stored in WebTopicList". Images are taken from the images subdirectory of our MediaWiki installation at /var/www/mediawiki. We prepared a template web called _mediawiki_defaul that will be used when creating TWiki webs. We have some perl code in that defines some custom conversions only of relevance for our own content. Source pages that match the regular expression MediaWiki|Bild|Kategorie will be excluded from the translation process.


The only mandatory option is the name of the MediaWiki dump file from which content is extracted. Before you start extracting large amount of data you should test the conversion result by using the -debug, -dry and -max.

more docu please

Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
  • Unzip in your twiki installation directory. Content:
    File:Sorted ascending Description:

  • Verify that the tool works fine by going to the tools subdirectory of your TWiki installation and type ./mediawiki2twiki --help

AddOn Info

Sponsored by

AddOn Author: TWiki:Main.MichaelDaum
Copyright ©: 2006-2007, Michael Daum
License: GPL (GNU General Public License)
AddOn Version: v1.0
Change History:  
20 Jul 2007 initial release
Dependencies: None
AddOn Home:

Topic revision: r0 - 2007-07-20 - TWikiContributor
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on at TWiki:TWiki.MediaWikiToTWikiAddOn