Ignore:
Timestamp:
2007-12-12T13:40:19+13:00 (16 years ago)
Author:
qq6
Message:

updated by Veronica

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/HTMLPlug.pm

    r14665 r14913  
    4343
    4444use Image::Size;
     45use File::Copy;
    4546
    4647sub BEGIN {
     
    107108    'desc' => "{HTMLPlug.sectionalise_using_h_tags}",
    108109    'type' => "flag" },
    109       { 'name' => "tidy_html",
     110      { 'name' => "use_realistic_book",
    110111        'desc' => "{HTMLPlug.tidy_html}",
    111112    'type' => "flag"},
    112       { 'name' => "old_style_HDL",
     113      { 'name' => "is_old_HDL_tags",
    113114        'desc' => "{HTMLPlug.old_style_HDL}",
    114115    'type' => "flag"}   
     
    349350   
    350351    my $test_dirname = "";
    351     if ($dirname =~ /import\//)
     352    my $f_separator = &util::get_os_dirsep();
     353   
     354   if ($dirname =~ /import$f_separator/)
    352355    {
    353356        $test_dirname = $';
     
    355358    #print STDERR "init $'\n";
    356359   
    357     while ($test_dirname =~ /[\/]/)
     360    while ($test_dirname =~ /[$f_separator]/)
    358361    {
    359362        my $folderdirname = $`;
     
    361364            &util::mk_dir($tmp_dirname) if (!-e $tmp_dirname);
    362365        $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    }
    382368   
    383369    my $tmp_filename = &util::filename_cat($tmp_dirname, "$tailname$suffix");
     
    406392        {
    407393            # 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 $!";
    413395        }
    414396    }
     
    428410    {
    429411            # 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 $!";
    435413    }
    436414    }
     
    498476
    499477        # 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`;
    501479
    502480        # write result back to the tmp file
     
    525503    if (($self->{'tidy_html'}) || ($self->{'old_style_HDL'}))
    526504    {
     505        # because the document has to be sectionalized set the description tags
     506        $self->{'description_tags'} = 1;
     507
    527508        # set the file to be tidied
    528509            $input_filename = &util::filename_cat($base_dir,$file) if $base_dir =~ /\w/;
Note: See TracChangeset for help on using the changeset viewer.