Differences

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

Link to this comparison view

dev:wiki-convert [2018/02/07 16:07]
dev:wiki-convert [2022/05/06 16:07] (current)
Line 1: Line 1:
 +=====Pleasantly ugly script to convert from SourceForge wiki format (WikiSpaces) to Dokuwiki=====
  
 +<code perl>
 +#!/usr/bin/perl
 +
 +while (<>) {
 +  my $h='H_E_A_D_I_N_G';
 +  s/^====(.*)====$/$h$h$h$1$h$h$h/;
 +  s/^===(.*)===$/$h$h$h$h$1$h$h$h$h/;
 +  s/^==(.*)==$/$h$h$h$h$h$1$h$h$h$h$h/;
 +  s/^=(.*)=$/$h$h$h$h$h$h$1$h$h$h$h$h$h/;
 +  s/$h/=/g;
 +  if (/\[\[code[^\]]*\]\]/) {
 +    if ($incode) {
 +      s/\[\[code\]\]/<\/code>/;
 +      $incode=0;
 +    } else {
 +      s/\[\[code\]\]/<code>/;
 +      s/\[\[code( format=\"([^\"]*)\")?\]\]/<code $2>/;
 +      $incode=1;
 +    }
 +  }
 +  s/^\* /  * /;
 +  s/^\# /  - /;
 +  s/^{{(.*)}}/<code bash>
 +$1
 +<\/code>/;
 +  $prevnormal=$normal;
 +  if (/^[^<]/) { $normal = 1; } else { $normal = 0; }
 +  if ($prevnormal eq $normal) {
 +    print "\n";
 +  }
 +  print;
 +}
 +
 +</code>
 
 
dev/wiki-convert.txt ยท Last modified: 2022/05/06 16:07 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki