Posted by Helmuti_pdorf on 12 Dec 2008 19:03, last edited by Rolandius on 21 Apr 2011 07:32
Tags: conversion convert konversion mediawiki
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 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 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 Sanantonio. Please visit his/her userPage.
Other(!) HowTos posted by Helmuti_pdorf
- Site Checklist
- Button Links
- MindMaps in Wikidot
- Setup an "Educational Wiki"
- Use html scripting
- Tabview with ListPages
- Add chessdiagrams
- Create a news entry list
- Show page to specific users only
- Apply A Wikipedia Like Talk Button
- Use Anchors on a page
- Insert Pictures In A Page
- Embed Google+ Button
- Find Untagged Pages
- New table layout with ROW and CELL tag
- Logout From Wikidot
- Site Start
- Import Ms Word -Text Into Wikidot
- Links With Special Characters
- Add Admins Or Moderators To Your Site
- Sortable-Tables-Js
- Send E Mail invitations






I built on what Cameron had (thanks Cameron!), converted it to Ruby, and now have a script that will give you at least a good starting point when migrating a site from Mediawiki to Wikidot. Check out: https://github.com/lynnfaraday/wikiMigrate