Wikispaces to Mediawiki Converter

From Some Wiki

Jump to: navigation, search

Contents

What's this?

The Wikispaces to Mediawiki converter is a python script that converts wiki source pages from Wikispaces format to Mediawiki format. Currently, the incompatibility of Wikispaces syntax with any existing open-source wiki creates a bit of a lock-in for users wishing to move off wikispaces. This project seeks to address this problem by providing an easy migration path to Mediawiki - one of the most popular open source wiki projects.

The script is currently functional, but does not yet support all of the Wikispaces syntax. I welcome your help in improving the code.

Download

The script lives in this github repository. Just grab the latest version.

Features

The following is the list of supported syntax:

  • Text formatting:
    • Headings (same format as Mediawiki)
    • Bulleted lists (same format as Mediawiki)
    • Numbered lists (same format as Mediawiki)
    • Bold
    • Italics
    • Underline
    • Monospaced fonts
    • Escaped text
    • Indents
  • Links
    • Plain external links
    • Labeled external links
    • Internal links (same format as Mediawiki)
    • [[image:...]] tags, with all attributes
    • [[file:...]] links, at your option either converted to external links to your file host, or to [[Media:...]] tags.
  • Other layout
    • Horizontal line (same format as Mediawiki)
    • Tables, including headings, alignment (but not multi-column cells)
    • Table of contents
  • Page includes
  • Special tags
    • [[code]] tags (no syntax highlighting, Mediawiki doesn't support it out of the box)
    • [[math]] tags
  • Change {$page} variable to page name. (Other variables not supported)

Anything that's not listed here is probably not supported - but to be really sure, just try it, or look at the source.

For reference, here is the official Wikispaces syntax guide, and here is the official Mediawiki syntax guide.

Instructions

Save your Wikispaces-formatted files to disk (or use the handy backup tool in your "Manage Space" toolbox on Wikispaces).

Run the python script, specifying what files you want converted with the "-f" option. The output files will be written to the same filenames, but with "_mediawiki" appended to the filename.

For example, if your source file is called mywikispaceshome.txt, and is located in the same directory as the python script, run the following command to convert it:

python wstomwconverter.py -f mywikispaceshome.txt

This will create a file called mywikispaceshome.txt_mediawiki in the same directory.

Here's the full help as printed with the "-h" option, reproduced here for your convenience:

Usage
=====
  wstomwconverter.py [options]
 or 
  python wstomwconverter.py [options]

This script can convert a Wikispaces-style source page into a MediaWiki-style
source page. For a more detailed usage manual, see the project homepage:
http://wiki.df.dreamhosters.com/wiki/Wikispaces_to_Mediawiki_Converter

Options
=======
--version               show program's version number and exit
--help, -h              show this help message and exit
--debug, -d             debug mode (print some extra debug output). [default:
                        False]
--file=FILE, -f FILE    Specify filepath to convert. For multiple files use
                        this option multiple times. [default: []]
--filelocation=FILELOCATION, -l FILELOCATION
                        Specify the full URL of directory where files are
                        hosted. This will be used to convert [[file:...]]
                        links to external links. [default:
                        http://localhost/files/]
--usemedia, -m          Use the [[Media:...]] tag instead of external links to
                        convert [[file:...]] links. Note that by default
                        Mediawiki doesn't allow uploads of non-image files.
                        [default: False]

License

This code is licensed under the GPL v3 or later.

Help

If you need help, post something in the discussion page here, or send me email.

If you would like to help, you can:

  • send me email with your suggestions/feature requests/patches
  • fork the git repo on github and start coding. :)