- Timestamp:
- 2007-12-12T13:40:19+13:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/HTMLPlug.pm
r14665 r14913 43 43 44 44 use Image::Size; 45 use File::Copy; 45 46 46 47 sub BEGIN { … … 107 108 'desc' => "{HTMLPlug.sectionalise_using_h_tags}", 108 109 'type' => "flag" }, 109 { 'name' => " tidy_html",110 { 'name' => "use_realistic_book", 110 111 'desc' => "{HTMLPlug.tidy_html}", 111 112 'type' => "flag"}, 112 { 'name' => " old_style_HDL",113 { 'name' => "is_old_HDL_tags", 113 114 'desc' => "{HTMLPlug.old_style_HDL}", 114 115 'type' => "flag"} … … 349 350 350 351 my $test_dirname = ""; 351 if ($dirname =~ /import\//) 352 my $f_separator = &util::get_os_dirsep(); 353 354 if ($dirname =~ /import$f_separator/) 352 355 { 353 356 $test_dirname = $'; … … 355 358 #print STDERR "init $'\n"; 356 359 357 while ($test_dirname =~ /[ \/]/)360 while ($test_dirname =~ /[$f_separator]/) 358 361 { 359 362 my $folderdirname = $`; … … 361 364 &util::mk_dir($tmp_dirname) if (!-e $tmp_dirname); 362 365 $test_dirname = $'; 363 #print STDERR "folder $`\n"; 364 } 365 366 #my $folderdirname = $'; 367 #$tmp_dirname = &util::filename_cat($tmp_dirname,$folderdirname); 368 #&util::mk_dir($tmp_dirname) if (!-e $tmp_dirname); 369 #print STDERR "folderdirnae $'\n"; 370 371 #$test_dirname =~ s/[\\\/]+$//; 372 #print STDERR "$'"; 373 } 374 375 # remove trailing slashes 376 #$dirname =~ s/[\\\/]+$//; 377 # create folder for this file 378 #my $folderdirname = &File::Basename::basename($dirname); 379 #my $folderdirname = $test_dirname; 380 #$tmp_dirname = &util::filename_cat($tmp_dirname,$folderdirname); 381 #&util::mk_dir($tmp_dirname) if (!-e $tmp_dirname); 366 } 367 } 382 368 383 369 my $tmp_filename = &util::filename_cat($tmp_dirname, "$tailname$suffix"); … … 406 392 { 407 393 # just copy the original file back to the tmp directory 408 open (TIDYIN, "< $src_file") or die "Can't open $src_file : $!"; 409 open (TIDYOUT, "> $dest_file") or die "Can't open $dest_file : $!"; 410 print TIDYOUT <TIDYIN>; 411 close TIDYIN; 412 close TIDYOUT; 394 copy($src_file,$dest_file) or die "Can't copy file $src_file to $dest_file $!"; 413 395 } 414 396 } … … 428 410 { 429 411 # just copy the original file back to the tmp directory 430 open (TIDYIN, "< $input_filename") or die "Can't open $input_filename : $!"; 431 open (TIDYOUT, "> $tmp_filename") or die "Can't open $tmp_filename : $!"; 432 print TIDYOUT <TIDYIN>; 433 close TIDYIN; 434 close TIDYOUT; 412 copy($input_filename,$tmp_filename) or die "Can't copy file $input_filename to $tmp_filename $!"; 435 413 } 436 414 } … … 498 476 499 477 # run html-tidy on the tmp file to make it a proper XML file 500 my $tidyfile = `tidy - wrap 0 -asxml $tmp_filename`;478 my $tidyfile = `tidy -utf8 -wrap 0 -asxml $tmp_filename`; 501 479 502 480 # write result back to the tmp file … … 525 503 if (($self->{'tidy_html'}) || ($self->{'old_style_HDL'})) 526 504 { 505 # because the document has to be sectionalized set the description tags 506 $self->{'description_tags'} = 1; 507 527 508 # set the file to be tidied 528 509 $input_filename = &util::filename_cat($base_dir,$file) if $base_dir =~ /\w/;
Note:
See TracChangeset
for help on using the changeset viewer.