Convert MediaWiki syntax to Wikidot

Posted by Helmut_pdorf on 12 Dec 2008 19:03, last edited by Helmut_pdorf on 19 Apr 2013 18:59

Tags: conversion convert konversion mediawiki word

rating: +2+x

Such functionality would be great! But the work for such conversion program is great and need a lot of team work…

Here is the start with a first try of a little program. Thanks to Cameron SanantonioCameron Sanantonio who made the start.

I copied this from a post in the community forum. This can be a project in the future… now it is only a beginning…


Cameron SanantonioCameron Sanantonio wrote:

I knocked this up in a two hour coding session tonight. I have a wiki over at Wikia.com… unfortunatly I have two problems with them. (1) Slow, (2) Ads. 1 is kinda random… sometimes the wiki is really really fast, many times it's not. And while I don't normally mind web ads, the way they do 2 breaks standard Wiki layout. I had picked them because I wanted to import my older Mediawiki wiki without lots of personal work.

Well, I'd rather host the wiki here, but nobody wanted to volunteer to convert the MediaWiki syntax to Wikidot syntax. So I built a script to do (most of) it.

http://autodmc.org/wikimedia-to-wikidot.php

Paste your MediaWiki text into the textbox, click submit, wait a bit while my handful of regular expressions crunch over the file, and then take the output out of the top box when the page loads.

What can it convert?

  • Headings
  • Most Wiki Links
  • Bold, Italic, Underline, Strikeout
  • Ordered, Unordered, Mixed Lists
  • TOC tags
  • Comments
  • <nowiki> and <pre>
  • Super and sub scripts

The regexes could most likely be better written, they're my first stab at flying solo in regex land.

This code currently doesn't touch images or tables. Images because I'm tired, tables because I don't want to jump into that pit.

And the code isn't perfect; sometimes it misses a tag. That's the (much of) and (mostly) bits above.

Here's an example of a conversion:
Wikia: http://usflexicon.wikia.com/wiki/USS_Lexington
Wikidot: http://thelexicon.wikidot.com/usslexington-direct-import

I added some junk code between the TOC and the first heading while doing the direct-import:

<!-- Commenty Goodness *(*&)@#(*&$(^ -->

<nowiki> '''''Do not render!''''' </nowiki>
<pre> LOL </pre>
<nowiki> <pre> WTF </nowiki> </pre>

Some <s>Strikeout</s> and <del>Deleted</del> materials, followed by <ins>Inserted</ins> and <u>underline!</u>

LOL<sub>WHUT</sub> or LOL<sup>WHUT</sup>.

MediaWiki allows you to add Category as links at the bottom of the articles… is something similar to this possible in Wikidot? If not, just cut those bits off when you're done converting.

As you can see, it doesn't do everything but it takes some of the drudgery out of converting articles, especially for big articles. Just run a quick eye over a Preview of the page and you'll catch the errors most likely.

ideas on how to make the regexs suck less? Wanna tackle images or tables? Let me know and I'll update the code. If you guys like it, I'll spiff the page up a bit (it's just a hacked internal tool right now :D).


Links

This is an idea first shown in the post: http://community.wikidot.com/forum/t-111212/convert-much-of-mediawiki-syntax-to-wikidot-syntax-mostly#post-328152.

Backlinks

Author

Cameron SanantonioCameron Sanantonio. Please visit his/her userPage.


Add a New Comment

Related articles

Comments

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.