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:44] 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 208: Line 223:
 exit 0 exit 0
 </code> </code>
 +
 ===== Notes ===== ===== Notes =====
  
tips/twiki_to_dokuwiki_conversion.1258497843.txt.gz · Last modified: 2009-11-17 23:44 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