I have written a php page and a bash/perl script to help facilitate converting UseMod Wiki pages to DokuWiki pages. add links to bash, perl, UseMod, and DokuWiki in the previous sentence
You can find my UseMod to DokuWiki php script here. It is straightforward to use: simply paste in the UseMod Wiki syntax code into the textbox area, and click submit. Then copy the generated code into your desired DokuWiki page.
Please post any additional limitations.
We are using double **'s in some of our pages to denote modification/creation dates in the wiki syntax. This conflicts with 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.
Here is the code to my bash/perl script:
Please post any additional limitations.
#! /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' $* # <br>'s perl -pi -e 's/\<br\>/\\\\ /g' $* exit 0