====== UseMod Wiki Syntax conversion to DokuWiki ====== I have written a php page and a bash/perl script to help facilitate converting [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] Wiki pages to [[doku>wiki:dokuwiki|DokuWiki]] pages. FIXME add links to bash, perl, [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]], and [[doku>wiki:dokuwiki|DokuWiki]] in the previous sentence ===== PHP Web conversion ===== You can find my [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] to [[doku>wiki:dokuwiki|DokuWiki]] php script here. It is straightforward to use: simply paste in the [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] Wiki syntax code into the textbox area, and click submit. Then copy the generated code into your desired [[doku>wiki:dokuwiki|DokuWiki]] page. ==== Limitations ==== * This script does not currently convert tables or quotes (I'm not sure if [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] supports them...). * This will not convert embedded [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] images properly - they will just show up as regular links. Please post any additional limitations. ==== CUIT Specific rules ==== We are using double %%**%%'s in some of our pages to denote modification/creation dates in the wiki syntax. This conflicts with [[doku>wiki:dokuwiki|DokuWiki's]] bold syntax (which is %%**%%text to bold%%**%%). To work around this, the php script will convert: %%(\s)(\*\*)([^\*])%% [space%%**%%notAsterisk] to: %%\s-[^\*]%% [space-notAsterisk] In order for this work-around to function, I had to set bold tags to %%#**#%%, then match the %%**%%'s, then clean up the bold tags. ==== The Link ==== [[https://wiki.thoughtbit.com/secure/usemodconvert.php|UseModToDokuWiki]] ===== Bash/Perl Script ===== Here is the code to my bash/perl script: ==== Limitations ==== * This script does not currently convert tables or quotes (I'm not sure if [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] supports them...). * This will not convert embedded [[http://www.usemod.com/cgi-bin/wiki.pl|UseMod]] images properly - they will just show up as regular links. Please post any additional limitations. ==== The Code ==== #! /bin/sh # UseMod Wiki to Dokuwiki Converter # by John Friar jfriarNOTDOTcolumbiaNOTATedu # Licence: GPL (http://www.gnu.org/licenses/gpl.txt) if [ -z "$1" ]; then echo "Usage: $0 UseModFilename.txt or *.txt\n" exit fi INPUT=$* # Headings perl -pi -e 's/^======([^\=]+)======/=$1=/g' $* perl -pi -e 's/^=====([^\=]+)=====/==$1==/g' $* perl -pi -e 's/^====([^\=]+)====/===$1===/g' $* perl -pi -e 's/^===([^\=]+)===/====$1====/g' $* perl -pi -e 's/^==([^\=]+)==/=====$1=====/g' $* perl -pi -e 's/^=([^\=]+)=/======$1======/g' $* # unordered lists perl -pi -e 's/^\*\*\*\*\s/ \* /g' $* perl -pi -e 's/^\*\*\*\s/ \* /g' $* perl -pi -e 's/^\*\*\s/ \* /g' $* perl -pi -e 's/^\*\s/ \* /g' $* # ordered lists perl -pi -e 's/^####\s/ - /g' $* perl -pi -e 's/^###\s/ - /g' $* perl -pi -e 's/^##\s/ - /g' $* perl -pi -e 's/^#\s/ - /g' $* # links perl -pi -e 's/([^\[])(\[)([^\]])(\])([^\]])/$1\[$2$3$4\]$5/g' $* perl -pi -e 's/([^\[])(\[http)/$1\[$2/g' $* perl -pi -e 's/([^\]]\])([^\]])/$1\]$2/g' $* perl -pi -e 's/(\[\[http[^\s]+)\s/$1\|/g' $* perl -pi -e 's/(\[\[http[^\n])\n/$1\|/g' $* # bold, italic perl -pi -e "s/'''/**/g" $* perl -pi -e "s/''/\/\//g" $* # definitions (you need the explain plugin) perl -pi -e 's/\;([^\:]+)\:(.*)/\? $1\n\! $2\n\n/g' $* #
's perl -pi -e 's/\/\\\\ /g' $* exit 0
== == {{tag>:plugin :wiki}}