-
Notifications
You must be signed in to change notification settings - Fork 0
/
dokuwiki2redmine.pl
33 lines (20 loc) · 1.02 KB
/
dokuwiki2redmine.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# _really_ basic DokuWiki (MediaWiki) to Redmine (Textile) converter
# For up to date versions of DokuWiki and Redmine there are better tools available, like https://github.com/GSI/mrmt
# This worked for converting from DokuWiki 2009-12-25c to Redmine 1.2.1
# Usage: perl dokuwiki2redmine.pl < /var/www/dokuwiki/data/pages/path/mypage.txt
while (<>) {
s/\\\\/ /g; # blank line
s/^ \*/*/g; # L1 indent
s/^ \*/**/g; # L2 indent
s/^ \*/***/g; # L3 indent
s/^ \*/****/g; # L4 indent
s/ -> / → /g; # right arrow
s/''(.+)''/@ $1 @/g; # monospace
s/====== (.+) ======/h2. $1/g; # headings
s/\*\* (.+) \*\*/**$1**/g; # bold: * ... * --> *...*
s/%%(.+)%%/<notextile>$1<\/notextile>/g; # nowiki
s|<del>(.+)</del>|-$1-|g; # strike-through
s|<code>|<pre>|g;
s|</code>|</pre>|g;
print;
}