-
-
Save donghee/69e331bfdf7fe3d2452b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -ni.bak | |
# from: http://www.emilsit.net/blog/archives/migrating-from-moinmoin-to-dokuwiki/ | |
BEGIN { $readblank = 0; } | |
$readblank = 1 if /^$/; | |
# Fix line-endings for Unix | |
# $//; | |
# Ignore all pragmas | |
next if !$readblank and /^#/; | |
# Fix different a href linking styles | |
s/\[(http:\S+)\s+(.*?)]/[\[$1|$2\]]/g; | |
# Fix lists that aren't indented enough | |
s/^ \*/ \*/; | |
# Fix ordered lists | |
s/^(\s+)\d+\./$1-/; | |
# Fix code blocks | |
s/^{{{$/<code>/; | |
s/^}}}$/<\/code>/; | |
# Fix monospace/code text | |
s/`/''/g; | |
s/{{{(.*?)}}}/''$1''/g; | |
# Fix headers | |
s/^= (.*) =$/====== $1 ======/g; | |
s/^== (.*) ==$/===== $1 =====/g; | |
s/^=== (.*) ===$/==== $1 ====/g; | |
print; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from dokuwiki import DokuWiki, DokuWikiError | |
import sys | |
import subprocess | |
import fileinput | |
import glob | |
def to_doku(d, page_id, txt): | |
try: | |
d.pages.set(page_id, txt) | |
except DokuWikiError as err: | |
print err | |
def cat(f): | |
return subprocess.check_output('cat '+ f +' | iconv -f cp949 -t utf8' , shell=True) | |
def moin2doku(f): | |
return subprocess.check_output('cat '+ f+' | iconv -f cp949 -t utf8 | perl migrate.pl' , shell=True) | |
d = DokuWiki('http://xx.xx/wiki', 'xx', 'xx', allow_none=True) | |
for f in glob.glob('*'): | |
print f | |
to_doku(d, f, moin2doku(f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment