Unlimited Faxes, No Fees, Dedicated Phone Number
I hosted this site on wiki.splitbrain.org, the official site, because it fits in there and the bandwidth here is not the best. I’ll try to keep these pages in sync. Post there!
A online converter is now hosted at http://johbuc6.coconia.net/mediawiki2dokuwiki.php.
Hey, I was playing with awk & perl a little bit. I created a MediaWiki to Dokuwiki Converter.
It is able to transform
It is not able to transform
File mediawiki2dokuwiki.sh:
#! /bin/sh # Mediawiki2Dokuwiki Converter # originally by Johannes Buchner <buchner.johannes [at] gmx.at> # Licence: GPL (http://www.gnu.org/licenses/gpl.txt) # Headings cat mediawiki | \ perl -pe 's/^[ ]*=([^=])/<h1> ${1}/g' | \ perl -pe 's/([^=])=[ ]*$/${1} <\/h1>/g' | \ perl -pe 's/^[ ]*==([^=])/<h2> ${1}/g' | \ perl -pe 's/([^=])==[ ]*$/${1} <\/h2>/g' | \ perl -pe 's/^[ ]*===([^=])/<h3> ${1}/g' | \ perl -pe 's/([^=])===[ ]*$/${1} <\/h3>/g' | \ perl -pe 's/^[ ]*====([^=])/<h4> ${1}/g' | \ perl -pe 's/([^=])====[ ]*$/${1} <\/h4>/g' | \ perl -pe 's/^[ ]*=====([^=])/<h5> ${1}/g' | \ perl -pe 's/([^=])=====[ ]*$/${1} <\/h5>/g' | \ perl -pe 's/^[ ]*======([^=])/<h6> ${1}/g' | \ perl -pe 's/([^=])======[ ]*$/${1} <\/h6>/g' \ > mediawiki1 cat mediawiki1 | \ perl -pe 's/<\/?h1>/======/g' | \ perl -pe 's/<\/?h2>/=====/g' | \ perl -pe 's/<\/?h3>/====/g' | \ perl -pe 's/<\/?h4>/===/g' | \ perl -pe 's/<\/?h5>/==/g' | \ perl -pe 's/<\/?h6>/=/g' | \ cat > mediawiki2 # lists cat mediawiki2 | perl -pe 's/^[\*#]{4}\*/ * /g' | \ perl -pe 's/^[\*#]{3}\*/ * /g' | \ perl -pe 's/^[\*#]{2}\*/ * /g' | \ perl -pe 's/^[\*#]{1}\*/ * /g' | \ perl -pe 's/^\*/ * /g' | \ perl -pe 's/^[\*#]{4}#/ \- /g' | \ perl -pe 's/^[\*\#]{3}\#/ \- /g' | \ perl -pe 's/^[\*\#]{2}\#/ \- /g' | \ perl -pe 's/^[\*\#]{1}\#/ \- /g' | \ perl -pe 's/^\#/ - /g' | \ cat > mediawiki3 #[link] => [[link]] cat mediawiki3 | perl -pe 's/([^\[])\[([^\[])/${1}[[${2}/g' | perl -pe 's/^\[([^\[])/[[${1}/g' | perl -pe 's/([^\]])\]([^\]])/${1}]]${2}/g' | perl -pe 's/([^\]])\]$/${1}]]/g' \ > mediawiki4 #[[url text]] => [[url|text]] cat mediawiki4 | perl -pe 's/(\[\[[^| \]]*) ([^|\]]*\]\])/${1}|${2}/g' \ > mediawiki5 # bold, italic cat mediawiki5 | perl -pe "s/'''/**/g" | perl -pe "s/''/\/\//g" \ > mediawiki6 # talks cat mediawiki6 | perl -pe "s/^[ ]*:/>/g" | perl -pe "s/>:/>>/g" | perl -pe "s/>>:/>>>/g" | perl -pe "s/>>>:/>>>>/g" | perl -pe "s/>>>>:/>>>>>/g" | perl -pe "s/>>>>>:/>>>>>>/g" | perl -pe "s/>>>>>>:/>>>>>>>/g" \ > mediawiki7 cat mediawiki7 | perl -pe "s/<pre>/<code>/g" | perl -pe "s/<\/pre>/<\/code>/g" > mediawiki8 cat mediawiki8 > dokuwiki
mediawiki2dokuwiki.sh.mediawiki in the same directory.cd) and execute: chmod +x mediawiki2dokuwiki.sh #we want to be able to execute it
./mediawiki2dokuwiki.sh‘dokuwiki’ you’ll find your DokuWiki-Syntax.
Remember, all the fame goes to me, cause I started this
! — Johannes Buchner 2006-01-26 19:27
Would be great if someone wants to improve this! What is needed:
perl -pe "s/^[ ]*\{\|[^\|]*$//g" |
perl -pe "s/^[ ]*\|\}[ ]*$//g" |
perl -pe "s/^[ ]*\|([^\|]+)\|[ ]*$/|${1}|/g"
# ...
But tables in Wikimedia are crap. I suggest to use a html2wiki implementation for this need (’cause the needs will be very special) like http://diberri.dyndns.org/html2wiki.html Johannes Buchner 2006-01-27 12:00