tips:moinmoin2doku
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips:moinmoin2doku [2010-02-06 23:16] – 88.66.43.178 | tips:moinmoin2doku [2023-09-01 18:31] (current) – [Discussion] glen | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Migration from MoinMoin to DokuWiki ====== | ====== Migration from MoinMoin to DokuWiki ====== | ||
+ | Code written in Python/PHP that can do full conversion: all pages and their history, including edit log. Also copies attachments. | ||
- | Below you will find scripts in PHP and Python to facilitate the conversion process. Before running them you must eliminate the leftmost ">" | + | Checkout files from [[https:// |
+ | * '' | ||
- | > FIXME Are there any parameters that need to be passed to the PHP script and how is that to be done? According to the code there should be three parameters. | + | Consult README for details. |
- | Another document on switching appears at http:// | + | **NB:** The project is no longer maintained (as I got my wiki converted), but it may work for you (at least better starting point than I had), feel free to send Pull-Requests. --- [[user> |
+ | ===== Other and older versions ===== | ||
- | ===== PHP ===== | + | You can dig the older versions |
- | + | ||
- | I have written a small PHP script to convert wiki pages from MoinMoin [[http:// | + | |
- | + | ||
- | <code php> | + | |
- | # | + | |
- | <?php | + | |
- | + | ||
- | //check comman line parameters | + | |
- | if ($argc != 3 || in_array($argv[1], | + | |
- | echo " | + | |
- | echo " | + | |
- | echo " | + | |
- | echo " | + | |
- | } | + | |
- | else { | + | |
- | //get input and output directories | + | |
- | $inDir = realpath($argv[1]) | + | |
- | $outDir = realpath($argv[2]) or die(" | + | |
- | //just print information | + | |
- | echo " | + | |
- | echo " | + | |
- | + | ||
- | //get all files from directory | + | |
- | if (is_dir($inDir)) { | + | |
- | $files = filesFromDir($inDir); | + | |
- | } | + | |
- | + | ||
- | //migrate each file | + | |
- | foreach ($files As $file) { | + | |
- | //convert filename | + | |
- | $ofile = convFileNames($file); | + | |
- | //just print information | + | |
- | echo " | + | |
- | + | ||
- | //read input file | + | |
- | $text = readFl($inDir."/" | + | |
- | + | ||
- | //convert content | + | |
- | $text = moin2doku($text); | + | |
- | + | ||
- | //encode in utf8 | + | |
- | $text = utf8_encode($text); | + | |
- | + | ||
- | //write output file | + | |
- | writeFl($outDir."/" | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | + | ||
- | function moin2doku($text) { | + | |
- | /* like convFileNames and more | + | |
- | * | + | |
- | * bold and italic, what goes wrong? | + | |
- | * | + | |
- | * | + | |
- | * | + | |
- | * Moin handles code sections without closing }}} right, DokuWiki does not | + | |
- | */ | + | |
- | + | ||
- | //line by line | + | |
- | $lines = explode(" | + | |
- | foreach($lines As $line) { | + | |
- | //start converting | + | |
- | $find = Array( | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/# | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | ); | + | |
- | $replace = Array( | + | |
- | '', | + | |
- | '', | + | |
- | ' | + | |
- | '', | + | |
- | ' | + | |
- | ' | + | |
- | '<>> | + | |
- | '<>>/ | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | '// | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | $line = preg_replace($find, | + | |
- | + | ||
- | $ret = $ret.$line." | + | |
- | } | + | |
- | return $ret; | + | |
- | } | + | |
- | + | ||
- | + | ||
- | function convFileNames($name) { | + | |
- | /* ö,ä,ü, ,. and more | + | |
- | */ | + | |
- | $find = Array('/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | '/ | + | |
- | ); | + | |
- | $replace = Array(' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | $name = preg_replace($find, | + | |
- | $name = strtolower($name); | + | |
- | return $name." | + | |
- | } | + | |
- | + | ||
- | + | ||
- | function filesFromDir($dir) { | + | |
- | $files = Array(); | + | |
- | $handle=opendir($dir); | + | |
- | while ($file = readdir ($handle)) { | + | |
- | if ($file != " | + | |
- | | + | |
- | } | + | |
- | } | + | |
- | closedir($handle); | + | |
- | return $files; | + | |
- | } | + | |
- | + | ||
- | function readFl($file) { | + | |
- | $fr = fopen($file," | + | |
- | if ($fr) { | + | |
- | while(!feof($fr)) { | + | |
- | $text = $text.fgets($fr); | + | |
- | } | + | |
- | fclose($fr); | + | |
- | } | + | |
- | return $text; | + | |
- | } | + | |
- | + | ||
- | function writeFl($file, | + | |
- | $fw = fopen($file, | + | |
- | if ($fw) { | + | |
- | fwrite($fw, $text); | + | |
- | } | + | |
- | fclose($fw); | + | |
- | } | + | |
- | + | ||
- | ?> | + | |
- | </ | + | |
- | + | ||
- | ===== Python ===== | + | |
- | + | ||
- | + | ||
- | Based on the above two I've written a python script that automates the file renaming, copying and conversion business. Worked for me on windows. | + | |
- | + | ||
- | <code python> | + | |
- | import sys, os, os.path | + | |
- | import re | + | |
- | from os import listdir | + | |
- | from os.path import isdir, basename | + | |
- | + | ||
- | def check_dirs(moin_pages_dir, | + | |
- | if not isdir(moin_pages_dir): | + | |
- | print >> sys.stderr, " | + | |
- | sys.exit(1) | + | |
- | if not isdir(output_dir): | + | |
- | print >> sys.stderr, " | + | |
- | sys.exit(1) | + | |
- | + | ||
- | + | ||
- | def get_page_names(moin_pages_dir): | + | |
- | items = listdir(moin_pages_dir) | + | |
- | pages = [] | + | |
- | for item in items: | + | |
- | item = os.path.join(moin_pages_dir, | + | |
- | if isdir(item): | + | |
- | pages.append(item) | + | |
- | return pages | + | |
- | + | ||
- | + | ||
- | def get_current_revision(page_dir): | + | |
- | rev_dir = os.path.join(page_dir, | + | |
- | revisions = listdir(rev_dir) | + | |
- | revisions.sort() | + | |
- | return os.path.join(rev_dir, | + | |
- | + | ||
- | + | ||
- | def convert_page(page): | + | |
- | regexp = ( | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | ('# | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | ) | + | |
- | for i in range(len(page)): | + | |
- | line = page[i] | + | |
- | for item in regexp: | + | |
- | line = re.sub(item[0], | + | |
- | page[i] = line | + | |
- | return page | + | |
- | + | ||
- | + | ||
- | def print_help(): | + | |
- | print " | + | |
- | print " | + | |
- | sys.exit(0) | + | |
- | + | ||
- | + | ||
- | def print_parameter_error(): | + | |
- | print >> sys.stderr, ' | + | |
- | sys.exit(1) | + | |
- | + | ||
- | + | ||
- | if __name__ == ' | + | |
- | if len(sys.argv) > 1: | + | |
- | if sys.argv[1] in (' | + | |
- | print_help() | + | |
- | elif len(sys.argv) > 2: | + | |
- | moin_pages_dir = sys.argv[1] | + | |
- | output_dir = sys.argv[2] | + | |
- | else: | + | |
- | print_parameter_error() | + | |
- | else: | + | |
- | print_parameter_error() | + | |
- | + | ||
- | check_dirs(moin_pages_dir, | + | |
- | print 'Input dir is: %s.' % moin_pages_dir | + | |
- | print ' | + | |
- | + | ||
- | + | ||
- | pages = get_page_names(moin_pages_dir) | + | |
- | for page in pages: | + | |
- | curr_rev = get_current_revision(page) | + | |
- | curr_rev_desc = file(curr_rev, | + | |
- | curr_rev_content = curr_rev_desc.readlines() | + | |
- | curr_rev_desc.close() | + | |
- | + | ||
- | curr_rev_content = convert_page(curr_rev_content) | + | |
- | + | ||
- | page_name = basename(page).lower() | + | |
- | out_file = os.path.join(output_dir, | + | |
- | out_desc = file(out_file, | + | |
- | out_desc.writelines([it.rstrip() + ' | + | |
- | out_desc.close() | + | |
- | + | ||
- | print ' | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ===== Extended Python ===== | + | |
- | I've extended above script to this. | + | |
- | It fixes some bugs from above, moves attachments, | + | |
- | Converts some Codes of German ' | + | |
- | Works in this version just on Linux, but should not be so difficult to convert to Windows. | + | |
- | Remember to change '<> | + | |
- | Use: | + | |
- | Download as convert.py | + | |
- | chmod a+rwx convert.py | + | |
- | ./ | + | |
- | + | ||
- | <code python> | + | |
- | # | + | |
- | import sys, os, os.path | + | |
- | + | ||
- | import re | + | |
- | + | ||
- | from os import listdir | + | |
- | + | ||
- | from os.path import isdir, basename | + | |
- | + | ||
- | + | ||
- | + | ||
- | def check_dirs(moin_pages_dir, | + | |
- | + | ||
- | if not isdir(moin_pages_dir): | + | |
- | + | ||
- | print >> sys.stderr, " | + | |
- | + | ||
- | sys.exit(1) | + | |
- | + | ||
- | if not isdir(output_dir): | + | |
- | + | ||
- | print >> sys.stderr, " | + | |
- | + | ||
- | sys.exit(1) | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | def get_page_names(moin_pages_dir): | + | |
- | + | ||
- | items = listdir(moin_pages_dir) | + | |
- | + | ||
- | pages = [] | + | |
- | + | ||
- | for item in items: | + | |
- | + | ||
- | item = os.path.join(moin_pages_dir, | + | |
- | + | ||
- | if isdir(item): | + | |
- | + | ||
- | pages.append(item) | + | |
- | + | ||
- | return pages | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | def get_current_revision(page_dir): | + | |
- | + | ||
- | rev_dir = os.path.join(page_dir, | + | |
- | + | ||
- | if isdir(rev_dir): | + | |
- | + | ||
- | revisions = listdir(rev_dir) | + | |
- | + | ||
- | revisions.sort() | + | |
- | + | ||
- | return os.path.join(rev_dir, | + | |
- | return '' | + | |
- | + | ||
- | def copy_attachments(page_dir, | + | |
- | + | ||
- | dir = os.path.join(page_dir,' | + | |
- | + | ||
- | if isdir(dir): | + | |
- | + | ||
- | attachments = listdir(dir) | + | |
- | for attachment in attachments: | + | |
- | + | ||
- | os.system ('cp "' | + | |
- | + | ||
- | + | ||
- | def convert_page(page, | + | |
- | + | ||
- | + | ||
- | namespace = ':' | + | |
- | for i in range(0, len(file) - 1): | + | |
- | namespace += file[i] + ':' | + | |
- | + | ||
- | regexp = ( | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | ('# | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | | + | |
- | (' | + | |
- | + | ||
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | + | ||
- | + | ||
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | + | ||
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | + | ||
- | (' | + | |
- | ) | + | |
- | + | ||
- | for i in range(len(page)): | + | |
- | + | ||
- | line = page[i] | + | |
- | + | ||
- | for item in regexp: | + | |
- | + | ||
- | line = re.sub(item[0], | + | |
- | + | ||
- | page[i] = line | + | |
- | + | ||
- | return page | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | def print_help(): | + | |
- | + | ||
- | print " | + | |
- | + | ||
- | print " | + | |
- | + | ||
- | sys.exit(0) | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | def print_parameter_error(): | + | |
- | + | ||
- | print >> sys.stderr, ' | + | |
- | + | ||
- | sys.exit(1) | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | if __name__ == ' | + | |
- | + | ||
- | if len(sys.argv) > 1: | + | |
- | + | ||
- | if sys.argv[1] in (' | + | |
- | + | ||
- | print_help() | + | |
- | + | ||
- | elif len(sys.argv) > 2: | + | |
- | + | ||
- | moin_pages_dir = sys.argv[1] | + | |
- | + | ||
- | output_dir = sys.argv[2] | + | |
- | + | ||
- | else: | + | |
- | + | ||
- | print_parameter_error() | + | |
- | + | ||
- | else: | + | |
- | + | ||
- | print_parameter_error() | + | |
- | + | ||
- | + | ||
- | + | ||
- | check_dirs(moin_pages_dir, | + | |
- | + | ||
- | print 'Input dir is: %s.' % moin_pages_dir | + | |
- | + | ||
- | print ' | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | pages = get_page_names(moin_pages_dir) | + | |
- | + | ||
- | for page in pages: | + | |
- | + | ||
- | curr_rev = get_current_revision(page) | + | |
- | + | ||
- | if os.path.exists(curr_rev): | + | |
- | page_name = basename(page).lower() | + | |
- | + | ||
- | curr_rev_desc = file(curr_rev, | + | |
- | + | ||
- | curr_rev_content = curr_rev_desc.readlines() | + | |
- | + | ||
- | curr_rev_desc.close() | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | if ' | + | |
- | + | ||
- | + | ||
- | page_name = page_name.replace(' | + | |
- | page_name = page_name.replace(' | + | |
- | page_name = page_name.replace(' | + | |
- | page_name = page_name.replace(' | + | |
- | page_name = page_name.replace(' | + | |
- | + | ||
- | split = page_name.split(' | + | |
- | + | ||
- | count = len(split) | + | |
- | + | ||
- | + | ||
- | + | ||
- | dateiname = split[-1] | + | |
- | + | ||
- | dir = output_dir | + | |
- | attachment_dir = output_dir + ' | + | |
- | if count == 1: | + | |
- | dir += ' | + | |
- | if not isdir (dir): | + | |
- | + | ||
- | os.mkdir(dir) | + | |
- | attachment_dir += ' | + | |
- | if not isdir (attachment_dir): | + | |
- | os.mkdir(attachment_dir) | + | |
- | for i in range(0, count - 1): | + | |
- | + | ||
- | dir += split[i] + '/' | + | |
- | + | ||
- | if not isdir (dir): | + | |
- | + | ||
- | os.mkdir(dir) | + | |
- | attachment_dir += split[i] + '/' | + | |
- | if not isdir (attachment_dir): | + | |
- | os.mkdir(attachment_dir) | + | |
- | if count == 1: | + | |
- | str = ' | + | |
- | split = str.split('/' | + | |
- | curr_rev_content = convert_page(curr_rev_content, | + | |
- | else: | + | |
- | curr_rev_content = convert_page(curr_rev_content, | + | |
- | + | ||
- | + | ||
- | out_file = os.path.join(dir, | + | |
- | + | ||
- | out_desc = file(out_file, | + | |
- | + | ||
- | out_desc.writelines([it.rstrip() + ' | + | |
- | + | ||
- | out_desc.close() | + | |
- | copy_attachments(page, | + | |
- | </ | + | |
- | + | ||
- | ===== Another Python Script ===== | + | |
- | Here is another " | + | |
- | + | ||
- | <code python> | + | |
- | # | + | |
- | # | + | |
- | # moin2doku.py | + | |
- | # | + | |
- | # A script for converting MoinMoin version 1.3+ wiki data to DokuWiki format. | + | |
- | # Call with the name of the directory containing the MoinMoin pages and that | + | |
- | # of the directory to receive the DokuWiki pages on the command line: | + | |
- | # | + | |
- | # python moin2doku.py ./ | + | |
- | # | + | |
- | # then move the doku pages to e.g. / | + | |
- | # move the media files to e.g. / | + | |
- | # set ownership: chown -R www-data: | + | |
- | # chown -R www-data: | + | |
- | # | + | |
- | # This script doesn' | + | |
- | # wrong. For instance attachment links end up with the trailing " | + | |
- | # on the line following the link. This works, but doesn' | + | |
- | # The script interprets a "/" | + | |
- | # creates and fills namespace subdirectories accordingly. | + | |
- | # | + | |
- | # version 0.1 02.2010 | + | |
- | # | + | |
- | # http:// | + | |
- | # | + | |
- | import sys, os, os.path, re, pdb | + | |
- | from os import listdir | + | |
- | from os.path import isdir, basename | + | |
- | + | ||
- | def check_dirs(moin_pages_dir, | + | |
- | + | ||
- | if not isdir(moin_pages_dir): | + | |
- | print >> sys.stderr, " | + | |
- | sys.exit(1) | + | |
- | + | ||
- | if not isdir(output_dir): | + | |
- | print >> sys.stderr, " | + | |
- | sys.exit(1) | + | |
- | + | ||
- | + | ||
- | def get_path_names(moin_pages_dir): | + | |
- | + | ||
- | items = listdir(moin_pages_dir) | + | |
- | pathnames = [] | + | |
- | + | ||
- | for item in items: | + | |
- | item = os.path.join(moin_pages_dir, | + | |
- | if isdir(item): | + | |
- | pathnames.append(item) | + | |
- | + | ||
- | return pathnames | + | |
- | + | ||
- | + | ||
- | def get_current_revision(page_dir): | + | |
- | + | ||
- | rev_dir = os.path.join(page_dir, | + | |
- | + | ||
- | if isdir(rev_dir): | + | |
- | revisions = listdir(rev_dir) | + | |
- | revisions.sort() | + | |
- | return os.path.join(rev_dir, | + | |
- | + | ||
- | return '' | + | |
- | + | ||
- | + | ||
- | def copy_attachments(page_dir, | + | |
- | + | ||
- | dir = os.path.join(page_dir,' | + | |
- | + | ||
- | if isdir(dir): | + | |
- | attachments = listdir(dir) | + | |
- | # | + | |
- | for attachment in attachments: | + | |
- | cmd_string = 'cp "' | + | |
- | os.system ( cmd_string ) | + | |
- | + | ||
- | + | ||
- | def convert_page(page, | + | |
- | + | ||
- | namespace = ':' | + | |
- | for i in range(0, len(file) - 1): | + | |
- | namespace += file[i] + ':' | + | |
- | + | ||
- | regexp = ( | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | ('# | + | |
- | (' | + | |
- | (' | + | |
- | ('" | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | ('^\s*=====\s*(.*)\s*=====\s*$', | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | (' | + | |
- | ) | + | |
- | + | ||
- | for i in range(len(page)): | + | |
- | line = page[i] | + | |
- | for item in regexp: | + | |
- | line = re.sub(item[0], item[1], line) | + | |
- | page[i] = line | + | |
- | return page | + | |
- | + | ||
- | def print_help(): | + | |
- | print " | + | |
- | print " | + | |
- | sys.exit(0) | + | |
- | + | ||
- | def print_parameter_error(): | + | |
- | print >> sys.stderr, ' | + | |
- | sys.exit(1) | + | |
- | + | ||
- | def fix_name( filename ): | + | |
- | filename = filename.lower() | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | filename = filename.replace(' | + | |
- | return filename | + | |
- | + | ||
- | # | + | |
- | # " | + | |
- | # | + | |
- | if len(sys.argv) > 1: | + | |
- | if sys.argv[1] in (' | + | |
- | print_help() | + | |
- | elif len(sys.argv) > 2: | + | |
- | moin_pages_dir = sys.argv[1] | + | |
- | output_dir = sys.argv[2] | + | |
- | else: | + | |
- | print_parameter_error() | + | |
- | else: | + | |
- | print_parameter_error() | + | |
- | + | ||
- | check_dirs(moin_pages_dir, | + | |
- | + | ||
- | print 'Input dir is: %s.' % moin_pages_dir | + | |
- | print ' | + | |
- | + | ||
- | pathnames = get_path_names(moin_pages_dir) | + | |
- | + | ||
- | for pathname in pathnames: | + | |
- | # | + | |
- | + | ||
- | curr_rev = get_current_revision( pathname ) | + | |
- | if not os.path.exists( curr_rev ) : continue | + | |
- | + | ||
- | page_name = basename(pathname) | + | |
- | if page_name.count(' | + | |
- | + | ||
- | curr_rev_desc = file(curr_rev, | + | |
- | curr_rev_content = curr_rev_desc.readlines() | + | |
- | curr_rev_desc.close() | + | |
- | + | ||
- | page_name = fix_name( page_name ) | + | |
- | + | ||
- | split = page_name.split(' | + | |
- | + | ||
- | count = len(split) | + | |
- | + | ||
- | dateiname = split[-1] | + | |
- | + | ||
- | dir = output_dir | + | |
- | # changed from attachment_dir = output_dir + ' | + | |
- | attachment_dir = output_dir + ' | + | |
- | if not isdir (attachment_dir): | + | |
- | os.mkdir(attachment_dir) | + | |
- | + | ||
- | if count == 1: | + | |
- | dir += ' | + | |
- | if not isdir (dir): | + | |
- | os.mkdir(dir) | + | |
- | + | ||
- | attachment_dir += ' | + | |
- | if not isdir (attachment_dir): | + | |
- | os.mkdir(attachment_dir) | + | |
- | + | ||
- | for i in range(0, count - 1): | + | |
- | + | ||
- | dir += split[i] + '/' | + | |
- | if not isdir (dir): | + | |
- | os.mkdir(dir) | + | |
- | + | ||
- | attachment_dir += split[i] + '/' | + | |
- | if not isdir (attachment_dir): | + | |
- | os.mkdir(attachment_dir) | + | |
- | + | ||
- | if count == 1: | + | |
- | str = ' | + | |
- | split = str.split('/' | + | |
- | curr_rev_content = convert_page(curr_rev_content, | + | |
- | else: | + | |
- | curr_rev_content = convert_page(curr_rev_content, | + | |
- | + | ||
- | out_file = os.path.join(dir, | + | |
- | out_desc = file(out_file, | + | |
- | out_desc.writelines([it.rstrip() + ' | + | |
- | out_desc.close() | + | |
- | + | ||
- | # pdb.set_trace() # start debugging here | + | |
- | copy_attachments(pathname, | + | |
- | </ | + | |
- | + | ||
- | ===== Perl ===== | + | |
- | + | ||
- | I've written more powerful conversion script, now it converts correctly (as I think ;-) ) all syntax from [[http:// | + | |
===== Discussion ===== | ===== Discussion ===== | ||
- | |||
> Why did you switch from MoinMoin to DokuWiki? | > Why did you switch from MoinMoin to DokuWiki? | ||
>> Because MoinMoin is **not as stable** as it looks like? You know the [[http:// | >> Because MoinMoin is **not as stable** as it looks like? You know the [[http:// | ||
- | >>> | + | |
+ | > Has anyone used this successfully to convert from MoinMoin 1.9.*? | ||
+ | >> I needed to migrate, because I am upgrading my servers | ||
+ | >> I tried to modify moin2doku to use it with MoinMoin 1.9, but I was not able, because there have been to many changes in MoinMoin. But I found a workaround. I have installed a migration-KVM with: | ||
+ | >> | ||
+ | >>I have manually added the following software | ||
+ | >> | ||
+ | >> | ||
+ | >> | ||
+ | >>I was able to copy my Debian-buster MoinMoin 1.9 data to this migration-KVM and convert it with moin2doku and after that copy it to my Debian-bookworm dokuwiki 0.0.20220731.a-2. But I had to make some >> | ||
+ | >> | ||
+ | >> | ||
+ | >> Thank You very much for moin2doku |
tips/moinmoin2doku.1265494601.txt.gz · Last modified: 2010-02-06 23:16 by 88.66.43.178