#!/usr/bin/perl -w
####
# Script to convert old c2.com wiki files to JSPWiki
####
foreach(@ARGV) {
$inputfilename = $_;
$outputfilename = "$inputfilename.txt";
open (INPUT,"< $inputfilename");
open (OUTPUT,"> $outputfilename");
;
$finished = 0;
while() {
s/(\263.*)+text\263(.+$)/$2/o; #header
# list
s/^~//go;
if (/^~/) {
s/~/\*/go;
}
# Bold
s/'{3}(.*)'{3}/__$1__/go;
# Italics are the same in JSPWiki
# s/'{2}(.*)'{2}/_$1_/go;
s/\263rev\263\d+\263date\263.+$//o; #footer
if (/\263copy\263/) {
$finished = 1;
}
if ($finished == 0) {
print OUTPUT $_;
}
}
close (INPUT);
close (OUTPUT);
@touch=("touch","-mr","$inputfilename","$outputfilename");
system(@touch);
}