Changeset 1578
- Timestamp:
- 2000-10-03T15:25:51+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/gsConvert.pl
r1567 r1578 230 230 ($input_filename, $output_filestem) = @_; 231 231 232 # print "Processing...\n";233 234 232 # formulate the command 235 my $wv_home = &util::filename_cat($ENV{'GSDLHOME'},"packages","wv-0.5.44-gs"); 236 my $wvHtml = &util::filename_cat($wv_home, "bin", "wvHtml"); 237 return 0 unless (-e "$wvHtml"); 238 $cmd = "$wvHtml --charset utf-8 \"$input_filename\" >\"$output_filestem.html\" 2>\"$output_filestem.err\""; 233 my $wv_home = &util::filename_cat($ENV{'GSDLHOME'}, "packages", "unix", "wv"); 234 my $wv_conf = &util::filename_cat($wv_home, "lib", "wv", "wvHtml.xml"); 235 my $wvWare = &util::filename_cat($wv_home, "bin", "wvWare"); 236 return 0 unless (-e "$wvWare"); 237 $cmd = "$wvWare --charset utf-8 --config $wv_conf"; 238 $cmd .= " \"$input_filename\" > \"$output_filestem.html\" 2>\"$output_filestem.err\""; 239 239 240 240 # execute the command 241 241 if (system($cmd)>0) 242 242 { 243 print STDERR "Error executing $cmd: $!. Continuing...\n";244 } 245 243 print STDERR "Error executing wv converter: $!. Continuing...\n"; 244 } 245 246 246 # Was the conversion successful? 247 247 if (-e "$output_filestem.html") { … … 249 249 $line = <TMP>; 250 250 close(TMP); 251 if ($line =~ /DOCTYPE HTML/) {251 if ($line && $line =~ /DOCTYPE HTML/) { 252 252 &util::rm("$output_filestem.err"); 253 253 return 1; … … 340 340 print HTML '<html><head> 341 341 <META HTTP-EQUIV="Content-Type" CONTENT="text/html"> 342 <META NAME="GENERATOR" CONTENT="Greenstone any -to-html">342 <META NAME="GENERATOR" CONTENT="Greenstone any_to_html"> 343 343 </head><body>\n\n'; 344 344 while (<TEXT>) { … … 364 364 while (<IN>) { 365 365 $line = $_; 366 366 367 367 # delete anything that isn't a printable character 368 368 $line =~ s/[^\040-\176]+/\n/sg; 369 369 370 370 # delete any string less than 10 characters long 371 $line =~ s/^[^\n]{0,9}$/\n/mg; 371 372 while ($line =~ /^[^\n]{1,9}$/m) { 372 373 $line =~ s/^[^\n]{0,9}$/\n/mg; … … 377 378 $line =~ s/\n+/\n/gs; 378 379 $line =~ s/^\n//gs; 379 380 380 381 # output whatever is left 381 if ($line =~ /[^\n ]/) {382 if ($line =~ /[^\n ]/) { 382 383 print OUT $line; 383 384 }
Note:
See TracChangeset
for help on using the changeset viewer.