MediaWiki 2 Foswiki Conversion Tool
Introduction
This is a commandline tool to import MediaWiki pages and images to
Foswiki. 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 Foswiki. It does
not map MediaWiki's category system onto Foswiki
as long as Foswiki lacks a standard category system. There are however many
ways to implement categories in Foswiki, one of which is the upcomming
ClassificationPlugin which implements true hierarchies and
semantic predicates to query categories and topics within. The mediawiki2foswiki
tool allows to map the MediaWiki categories onto any Foswiki 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 Foswiki'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, Foswiki
also parses 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 templates are called
"by reference" (passing the unparsed parameters) while Foswiki evaluates
INCLUDE
passing parameters "by value". This means, that WikiApplications
written for MediaWiki won't be translatable to WikiApplications
easily by this tool.
Documentation
The conversion tool is in
<path-to-your-foswiki>/tools/mediawiki2foswiki
.
Synopsis
mediawiki2foswiki
--file <dumpfile>
[--<debug>]
[--<defaultweb> <webname>]
[--<dry>]
[--<exclude> <regex>]
[--<help>]
[--<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
mediawiki2foswiki
--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 web called MediaWiki in our
current 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_default
that will be used when
creating webs. We have some Perl code in
MyConversionPlugin.pm
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.
Options
The only mandatory option is the name of the MediaWiki dump file from which
content is extracted. Before you start extracting large amounts of data you
should test the conversion result by using the -debug, -dry and -max.
more docu please
Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Contrib Info
Sponsored by