Ignore:
Timestamp:
2008-08-15T15:35:32+12:00 (16 years ago)
Author:
davidb
Message:

Edited needed to make pageImagePlugin work again after plugin restructuring

File:
1 edited

Legend:

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

    r16384 r16827  
    192192    push(@{$hashArgOptLists->{"OptList"}},$options);
    193193   
    194     new ImageConverter($pluginlist, $inputargs, $hashArgOptLists);
    195     new ReadTextFile($pluginlist, $inputargs, $hashArgOptLists, 1);
    196     my $self = new ReadXMLFile($pluginlist, $inputargs, $hashArgOptLists);
    197    
     194    my $imc_self = new ImageConverter($pluginlist, $inputargs, $hashArgOptLists);
     195    my $rtf_self = new ReadTextFile($pluginlist, $inputargs, $hashArgOptLists, 1);
     196    my $rxf_self = new ReadXMLFile($pluginlist, $inputargs, $hashArgOptLists);
     197
     198    my $self = BasePlugin::merge_inheritance($imc_self,$rtf_self,$rxf_self);
     199
     200    # Update $self used by XML::Parser so it finds callback functions
     201    # such as start_document here and not in ReadXMLFile (which is what
     202    # $self was when new XML::Parser was done)
     203    #
     204    # If the $self returned by this constructor is the same as the one
     205    # used in ReadXMLFile (e.g. in the GAPlugin) then this step isn't necessary
     206    #
     207    # Consider embedding this type of assignment into merge_inheritance
     208    # to help catch all cases?
     209
     210    $rxf_self->{'parser'}->{'PluginObj'} = $self;
     211
    198212    return bless $self, $class;
    199213}
     
    227241   
    228242    return q^(?i)(\.jpe?g|\.gif|\.png|\.tif?f|\.te?xt|\.html?|~)$^
     243###    return q^(?i)(\.jpe?g|\.gif|\.png|\.tif?f|\.te?xt|\.html?|\.css|\.opd|\.pdf|~)$^
    229244}
    230245
     
    233248{
    234249    my $self = shift (@_);
     250
    235251    $self->BasePlugin::read(@_);
    236252}
     
    241257    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
    242258    my $outhandle = $self->{'outhandle'};
     259    my $verbosity = $self->{'verbosity'};
    243260   
    244261    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
    245262
    246263    print $outhandle "PagedImagePlugin processing \"$filename_full_path\"\n"
    247     if $self->{'verbosity'} > 1;
     264    if $verbosity > 1;
    248265    print STDERR "<Processing n='$file' p='PagedImagePlugin'>\n" if ($gli);
    249266   
     
    354371    my ($filename_full_path, $filename_no_path, $doc_obj, $section, $rotate) = @_;
    355372    # do rotation
    356     if ($rotate eq "r") {
     373    if  ((defined $rotate) && ($rotate eq "r")) {
    357374    # check the filenames
    358375    return 0 if ($filename_no_path eq "" || !-f $filename_full_path);
     
    393410    my ($imgfile) = $_{'imgfile'};
    394411    if (defined $imgfile) {
    395         $self->process_image($self->{'base_dir'}.$imgfile, $imgfile, $doc_obj, $self->{'current_section'});
     412        # *****
     413        # What about support for rotate image (e.g. old ':r' notation)?
     414        $self->process_image($self->{'xml_file_dir'}.$imgfile, $imgfile, $doc_obj, $self->{'current_section'});
    396415    }
    397416    my ($txtfile) = $_{'txtfile'};
    398417    if (defined($txtfile)&& $txtfile ne "") {
    399         $self->process_text ($self->{'base_dir'}.$txtfile, $txtfile, $doc_obj, $self->{'current_section'});
     418        $self->process_text ($self->{'xml_file_dir'}.$txtfile, $txtfile, $doc_obj, $self->{'current_section'});
    400419    } else {
    401420        $self->add_dummy_text($doc_obj, $self->{'current_section'});
     
    450469
    451470    my ($dir, $file) = $self->{'filename'} =~ /^(.*?)([^\/\\]*)$/;
    452     $self->{'base_dir'} = $dir;
     471    $self->{'xml_file_dir'} = $dir;
    453472    $self->{'num_pages'} = 0;
    454473
     
    578597
    579598
    580     if ($text =~ m/<html.*?>\s*<head.*?>.*<\/head>\s*<body.*?>(.*)<\/body>\s*<\/html>\s*$/s) {
     599    if ($text =~ m/<html.*?>\s*<head.*?>.*<\/head>\s*<body.*?>(.*)<\/body>\s*<\/html>\s*$/is) {
    581600    # looks like HTML input
    582601    # no need to escape < and > or put in <pre> tags
Note: See TracChangeset for help on using the changeset viewer.