Changeset 3833


Ignore:
Timestamp:
2003-03-10T15:44:08+13:00 (21 years ago)
Author:
jrm21
Message:

fixed up parsing the use_sections argument.

File:
1 edited

Legend:

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

    r3720 r3833  
    6060    my $class = shift (@_);
    6161
    62     my ($noimages, $complex, $zoom);
     62    my ($noimages, $complex, $zoom, $use_sections);
    6363   
    6464    if (!parsargv::parse(\@_,
     
    6666             q^complex^, \$complex,
    6767             q^zoom/\d+/2^, \$zoom,
     68             q^use_sections/1?/^, \$use_sections,
    6869             "allow_extra_options")) {
    6970
     
    7374    }
    7475
     76
     77    my @args=@_;
     78    if ($use_sections) {
     79    push (@args, "-description_tags");
     80    }
     81
    7582    # following title_sub removes "Page 1" added by pdftohtml, and a leading
    7683    # "1", which is often the page number at the top of the page. Bad Luck
    7784    # if your document title actually starts with "1 " - is there a better way?
    7885
    79     my @args=();
    80     my $use_sections=0;
    81     while ($#_ > -1) {
    82     my $arg=shift(@_);
    83     if ($arg =~ /^\-use_sections/) {
    84         $use_sections=1;
    85         # in case someone put "-use_sections 1"
    86         $arg=shift(@_);
    87         if (defined($arg) && $arg ne "1") {
    88         push(@args, $arg);
    89         }
    90         push(@args, "-description_tags"); # so HTML uses sections...
    91         push(@args, @_); # any other args to PDFPlug...
    92         @_=();
    93         last;
    94     } else {
    95         push(@args, $arg);
    96     }
    97     }
    9886    my $self = new ConvertToPlug ($class, @args, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
     87
    9988    if ($use_sections) {
    10089    $self->{'use_sections'}=1;
    10190    }
     91
    10292    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    10393    my $option_list = $self->{'option_list'};
     
    153143sub process {
    154144    my $self = shift (@_);
    155 
    156145    if ($self->{'use_sections'}
    157146    && $self->{'converted_to'} eq "HTML") {
Note: See TracChangeset for help on using the changeset viewer.