DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:twiki_to_dokuwiki_conversion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:twiki_to_dokuwiki_conversion [2009-11-17 23:43] vachontips:twiki_to_dokuwiki_conversion [2010-03-20 21:23] (current) 88.66.13.59
Line 34: Line 34:
   * Change the permission of this file to allow execution   * Change the permission of this file to allow execution
     * <code>     * <code>
-      chmod u+x ./migratenamespace.sh +chmod u+x ./migratenamespace.sh 
-      chmod u+x ./twikiconverter.sh +chmod u+x ./twikiconverter.sh</code>
-      </code>+
   * From the terminal, run the migratenamespace.sh script against a twiki namespace   * From the terminal, run the migratenamespace.sh script against a twiki namespace
     * <code>./migratenamespace.sh MyWikiNamespace</code>     * <code>./migratenamespace.sh MyWikiNamespace</code>
   * Thats it! All of your TWiki documents are now DokuWiki documents imported into you new dokuwiki.   * Thats it! All of your TWiki documents are now DokuWiki documents imported into you new dokuwiki.
- 
 ===== Source Code ===== ===== Source Code =====
-<code bash>+<code bash migratenamespace.sh>
 #!/bin/bash #!/bin/bash
 #Twiki to DokuWiki File Converter #Twiki to DokuWiki File Converter
Line 73: Line 71:
  
  
-<code bash>+<code bash twikiconverter>
 #!/bin/bash #!/bin/bash
 #Twiki to DokuWiki Syntax Converter #Twiki to DokuWiki Syntax Converter
Line 136: Line 134:
 perl -pi -e 's/   \*/  \%\^/g' $* perl -pi -e 's/   \*/  \%\^/g' $*
  
-# Convert Ordered Lists +# Commented out. See below 
-perl -pi -e 's/\t\t\t\1/      \-/g' $* +# Convert Ordered Lists v1 
-perl -pi -e 's/\t\t\1/    \-/g' $* +#perl -pi -e 's/\t\t\t\1/      \-/g' $* 
-perl -pi -e 's/\t\1/   \-/g' $* +#perl -pi -e 's/\t\t\1/    \-/g' $* 
-perl -pi -e 's/            \1/        \-/g' $* +#perl -pi -e 's/\t\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' $*+#perl -pi -e 's/      \1/    \-/g' $* 
 +#perl -pi -e 's/   \1/  \-/g' $* 
 + 
 +# In Perl 5.1, the \1 in the capture group is supposed to reference a capturing group.  I assume the original author intended that to be a single "1" instead.  When the original set of commands are run against 5.1 an error is thrown and the text is not converted properly.  The modified version below throws no errors. 
 +# Convert Ordered Lists v2 
 +perl -pi -e 's/\t\t\t1/      \-/g' $* 
 +perl -pi -e 's/\t\t1/    \-/g' $* 
 +perl -pi -e 's/\t1/   \-/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' $*
  
 # Converting bold-italic text # Converting bold-italic text
Line 196: Line 205:
 perl -pi -e 's/\%META.*//g' $* perl -pi -e 's/\%META.*//g' $*
 perl -pi -e 's/\<br\>/\n/g' $* perl -pi -e 's/\<br\>/\n/g' $*
 +
 +#Name pre-formatted text as code
 +perl -pi -e 's/\<pre\>/\<code\>/g' $*
 +perl -pi -e 's/\<\/pre\>/\<\/code\>/g' $*
 +perl -pi -e 's/\<PRE\>/\<code\>/g' $*
 +perl -pi -e 's/\<\/PRE\>/\<\/code\>/g' $*
  
 #Fix Twiki's abuse of spaces in links #Fix Twiki's abuse of spaces in links
Line 221: Line 236:
  
   * This code has been updated (Nov 17, 2009) to support (at least in part) Twiki syntax as of 1.4.0. Although we had some legacy markup.  This also now handles ordered lists and other annoyances we found in the use of the tool, such as Twiki allowing spaces in page links and dokuwiki not.   * This code has been updated (Nov 17, 2009) to support (at least in part) Twiki syntax as of 1.4.0. Although we had some legacy markup.  This also now handles ordered lists and other annoyances we found in the use of the tool, such as Twiki allowing spaces in page links and dokuwiki not.
 +  * This will now import entire namespaces, instead of just converting existing files.
  
 --- [[vachon-dokuwiki@gamelogic.com|Thomas Vachon]]  --- [[vachon-dokuwiki@gamelogic.com|Thomas Vachon]] 
tips/twiki_to_dokuwiki_conversion.1258497798.txt.gz · Last modified: 2009-11-17 23:43 by vachon

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki