tips:docpdf2dokuwiki
This is an old revision of the document!
Import your doc and pdf files
Very crude yet, enhancements welcome!
#!/usr/bin/perl use HTML::WikiConverter; my $wc = new HTML::WikiConverter( dialect => 'DokuWiki' ); $txtpath = "/var/www/dokuwiki/data/pages/anleitungen"; $imgpath = "/var/www/dokuwiki/data/media/anleitungen"; @docfiles = </var/www/dokuwiki/data/pages/anleitungen/*.doc*>; @pdffiles = </var/www/dokuwiki/data/pages/anleitungen/*.pdf>; # Remove spaces and uppercase foreach $file (@docfiles) { $oldfile = $file; $file =~ s/\s+/_/g; $file = lc $file; rename($oldfile,$file); system("unoconv", "--format=html", "$file"); } foreach $file (@pdffiles) { $oldfile = $file; $file =~ s/\s+/_/g; $file = lc $file; rename($oldfile,$file); system("pdftohtml", "$file"); } @htmfiles = </var/www/dokuwiki/data/pages/anleitungen/*.html>; foreach $file (@htmfiles) { $newfile = $file; $newfile =~ s/\..*//; $newfile = "$newfile.txt"; print $newfile; print "\n"; open (MYFILE, ">>$newfile"); $input = $wc->html2wiki( file => $file ); print MYFILE "$input"; close (MYFILE); } system("chown", "-R", "www-data:www-data", "$path"); system("cp", "$txtpath/*.png", "$imgpath"); system("cp", "$txtpath/*.jpg", "$imgpath");
tips/docpdf2dokuwiki.1343998487.txt.gz · Last modified: 2012-08-03 14:54 by audiomobster