Changeset 22594

Show
Ignore:
Timestamp:
10.08.2010 11:51:17 (10 years ago)
Author:
kjdon
Message:

committing for davidb. pipe output of tidy to /dev/null if verbosity is low

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/HTMLPlugin.pm

    r22355 r22594  
    15761576    close (PROD) || die("Error Closing File: $tmp_filename $!"); 
    15771577 
     1578 
     1579    my ($language, $encoding) = $self->textcat_get_language_encoding ($input_filename); 
     1580    #print STDERR "*** encoding = $encoding\n"; 
     1581 
    15781582    # run html-tidy on the tmp file to make it a proper XML file 
    1579     my $tidyfile = `tidy -utf8 -wrap 0 -asxml "$tmp_filename"`; 
     1583 
     1584    my $outhandle = $self->{'outhandle'}; 
     1585    print $outhandle "Converting HTML to be XML compliant:\n"; 
     1586 
     1587    my $tidy_cmd = "tidy"; 
     1588    $tidy_cmd .= " -q" if ($self->{'verbosity'} <= 2); 
     1589    $tidy_cmd .= " -utf8 -wrap 0 -asxml \"$tmp_filename\""; 
     1590    if ($self->{'verbosity'} <= 2) { 
     1591    if ($ENV{'GSDLOS'} =~ m/^windows/i) { 
     1592        $tidy_cmd .= " 2>nul"; 
     1593    } 
     1594    else { 
     1595        $tidy_cmd .= " 2>/dev/null"; 
     1596    } 
     1597    print $outhandle "  => $tidy_cmd\n"; 
     1598    } 
     1599 
     1600    my $tidyfile = `$tidy_cmd`; 
    15801601 
    15811602    # write result back to the tmp file