[LON-CAPA-cvs] cvs: modules /gerd/Wiki convert.pl
www
www at source.lon-capa.org
Mon Dec 12 22:05:59 EST 2011
www Tue Dec 13 03:05:59 2011 EDT
Added files:
/modules/gerd/Wiki convert.pl
Log:
Wiki conversion script starting
Index: modules/gerd/Wiki/convert.pl
+++ modules/gerd/Wiki/convert.pl
use strict;
# Read the article index file
my %residx=();
my %resfile=();
my %duplicatecnt=();
open(IN,'dump/articles.dat');
while (my $line=<IN>) {
chomp($line);
my ($idx,$res)=split(/\t/,$line);
$residx{$line}=$idx;
my $file;
if ($res=~/\s[\-\â]+\s/) {
my ($dir,$remainder)=split(/\s+[\-\â]+\s+/,$res);
$dir=~s/\W//g;
$remainder=~s/\,/\_/g;
$remainder=~s/\s/\_/g;
$remainder=~s/\W//g;
$remainder=substr($remainder,0,20);
$file=$dir.'/'.$remainder;
} else {
$file=$res;
$file=~s/\,/\_/g;
$file=~s/\s/\_/g;
$file=~s/\W//g;
$file=substr($file,0,20);
}
$file=~s/\_+$//;
if ($resfile{$file}) {
$duplicatecnt{$file}++;
$file.='_'.$duplicatecnt{$file};
}
$resfile{$file}=$idx;
print $file."\n";
}
close(IN);
More information about the LON-CAPA-cvs
mailing list