Ignore:
Timestamp:
2006-10-27T13:41:01+13:00 (18 years ago)
Author:
kjdon
Message:

Moved all printing stuff out of doc.pm.
docprint now prints a GA representation of a doc obj - use &docprint::get_section_xml instead of $doc_obj->buffer_section_xml or $doc_obj->output_section.
Most of the code has been moved into plugouts, except for the bit thats gone to docprint.pm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugouts/GAPlugout.pm

    r12363 r13172  
    2828use strict;
    2929no strict 'refs';
     30no strict 'subs';
    3031
    3132eval {require bytes};
    3233use util;
    3334use BasPlugout;
     35use docprint;
    3436
    3537sub BEGIN {
     
    6163    my ($doc_obj,$doc_dir) = @_;
    6264
    63     my $output_dir = $self->get_output_dir();
    64     &util::mk_all_dir ($output_dir) unless -e $output_dir;
    65 
    66     my $working_dir = &util::filename_cat ($output_dir, $doc_dir);   
    67     &util::mk_all_dir ($working_dir) unless -e $working_dir;
    68 
    69     $self->process_assoc_files ($doc_obj, $doc_dir, '');
    70    
    71     my $output_file = util::filename_cat ($working_dir, "doc.xml");
    72 
    73     $self->open_xslt_pipe($output_file, $self->{'xslt_file'});
    74 
    75     my $outhandler;
    76 
    77     if (defined $self->{'xslt_writer'}){
    78        $outhandler = $self->{'xslt_writer'};
     65    my $outhandler;
     66    if ($self->{'debug'}) {
     67    $outhandler = STDOUT;
     68    # can we do the xslt and still do debug mode?
     69    }
     70    else {
     71    my $output_dir = $self->get_output_dir();
     72    &util::mk_all_dir ($output_dir) unless -e $output_dir;
     73   
     74    my $working_dir = &util::filename_cat ($output_dir, $doc_dir);   
     75    &util::mk_all_dir ($working_dir) unless -e $working_dir;
     76   
     77    $self->process_assoc_files ($doc_obj, $doc_dir, '');
     78   
     79    my $output_file = util::filename_cat ($working_dir, "doc.xml");
     80   
     81    $self->open_xslt_pipe($output_file, $self->{'xslt_file'});
     82   
     83   
     84    if (defined $self->{'xslt_writer'}){
     85        $outhandler = $self->{'xslt_writer'};
     86    }
     87    else{
     88        $outhandler = $self->get_output_handler($output_file);
     89    }
    7990    }
    80     else{
    81        $outhandler = $self->get_output_handler($output_file);
    82      }
    83    
     91   
    8492    $self->output_xml_header($outhandler,"Archive");
    85     $doc_obj->output_section($outhandler,$doc_obj->get_top_section());
     93    my $section_output = &docprint::get_section_xml($doc_obj, $doc_obj->get_top_section());
     94    print $outhandler $section_output;
    8695    $self->output_xml_footer($outhandler,"Archive");
    8796
    88     if (defined $self->{'xslt_writer'}){     
    89     $self->close_xslt_pipe();
     97    if (!$self->{'debug'}) {
     98    if (defined $self->{'xslt_writer'}){     
     99        $self->close_xslt_pipe();
     100    }
     101    else {
     102        close($outhandler);
     103    }
     104   
     105    $self->{'short_doc_file'} = util::filename_cat ($doc_dir, "doc.xml"); 
     106   
     107    $self->store_output_info_reference($doc_obj);
    90108    }
    91     else{
    92     close($outhandler);
    93     }
     109}
    94110
    95   $self->{'short_doc_file'} = util::filename_cat ($doc_dir, "doc.xml"); 
    96      
    97   $self->store_output_info_reference($doc_obj);
    98 }
     111
    99112
    1001131;
Note: See TracChangeset for help on using the changeset viewer.