Ignore:
Timestamp:
2008-06-05T09:29:32+12:00 (16 years ago)
Author:
kjdon
Message:

plugin overhaul: plugins renamed to xxPlugin, and in some cases the names are made more sensible. They now use the new base plugins. Hopefully we have better code reuse. Some of the plugins still need work done as I didn't want to spend another month doing this before committing it. Alos, I haven't really tested anything yet...

File:
1 edited

Legend:

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

    r15864 r15872  
    11###########################################################################
    22#
    3 # BibTexPlug.pm - a plugin for bibliography records in BibTex format
     3# BibTexPlugin.pm - a plugin for bibliography records in BibTex format
    44#
    55# A component of the Greenstone digital library software
     
    2727
    2828
    29 # BibTexPlug reads bibliography files in BibTex format.
     29# BibTexPlugin reads bibliography files in BibTex format.
    3030#
    3131# by Gordon W. Paynter ([email protected]), November 2000
    3232# Based on ReferPlug.  See ReferPlug for geneology.
    3333#
    34 # BibTexPlug creates a document object for every reference a the file.
    35 # It is a subclass of SplitPlug, so if there are multiple records, all
     34# BibTexPlugin creates a document object for every reference a the file.
     35# It is a subclass of SplitTextFile, so if there are multiple records, all
    3636# are read.
    3737#
     
    4242
    4343
    44 package BibTexPlug;
    45 
    46 use SplitPlug;
     44package BibTexPlugin;
     45
     46use SplitTextFile;
    4747use strict;
    4848no strict 'refs'; # allow filehandles to be variables and viceversa
    4949
    50 # BibTexPlug is a sub-class of BasPlug.
     50# BibTexPlugin is a sub-class of SplitTextFile.
    5151sub BEGIN {
    52     @BibTexPlug::ISA = ('SplitPlug');
     52    @BibTexPlugin::ISA = ('SplitTextFile');
    5353}
    5454
    5555my $arguments =
    5656    [ { 'name' => "process_exp",
    57     'desc' => "{BasPlug.process_exp}",
     57    'desc' => "{BasePlugin.process_exp}",
    5858    'type' => "regexp",
    5959    'reqd' => "no",
    6060    'deft' => &get_default_process_exp() },
    6161      { 'name' => "split_exp",
    62     'desc' => "{SplitPlug.split_exp}",
     62    'desc' => "{SplitTextFile.split_exp}",
    6363    'type' => "regexp",
    6464    'deft' => &get_default_split_exp(),
     
    6666      ];
    6767
    68 my $options = { 'name'     => "BibTexPlug",
    69         'desc'     => "{BibTexPlug.desc}",
     68my $options = { 'name'     => "BibTexPlugin",
     69        'desc'     => "{BibTexPlugin.desc}",
    7070        'abstract' => "no",
    7171        'inherits' => "yes",
     
    8282    return q^\n+(?=@)^;
    8383}
     84
    8485sub new {
    8586    my ($class) = shift (@_);
     
    8788    push(@$pluginlist, $class);
    8889
    89     if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
    90     if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    91 
    92     my $self = new SplitPlug($pluginlist, $inputargs, $hashArgOptLists);
     90    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
     91    push(@{$hashArgOptLists->{"OptList"}},$options);
     92
     93    my $self = new SplitTextFile($pluginlist, $inputargs, $hashArgOptLists);
    9394
    9495    return bless $self, $class;
     
    115116
    116117    # Report that we're processing the file
    117     print STDERR "<Processing n='$file' p='BibTexPlug'>\n" if ($gli);
    118     print $outhandle "BibTexPlug: processing $file\n"
     118    print STDERR "<Processing n='$file' p='BibTexPlugin'>\n" if ($gli);
     119    print $outhandle "BibTexPlugin: processing $file\n"
    119120    if ($self->{'verbosity'}) > 1;
    120121
     
    312313            $vonlast=shift @parts;
    313314            if (scalar(@parts) > 0) {
    314             print $outhandle "BibTexPlug: couldn't parse name $a\n";
     315            print $outhandle "BibTexPlugin: couldn't parse name $a\n";
    315316            # but we continue anyway...
    316317            }
     
    331332            # some non-English names do start with lowercase
    332333            # eg "Marie desJardins". Also we can get typos...
    333             print $outhandle "BibTexPlug: couldn't parse surname $vonlast\n";
     334            print $outhandle "BibTexPlugin: couldn't parse surname $vonlast\n";
    334335            $von="";
    335336            if ($vonlast =~ /^[a-z]+$/) {
     
    724725        my $replacement=$utf8_chars{$tex};
    725726        if (!defined($replacement)) {
    726         print STDERR "BibTexPlug: Warning: unknown latex accent \"$tex\" in \"$text\"\n";
     727        print STDERR "BibTexPlugin: Warning: unknown latex accent \"$tex\" in \"$text\"\n";
    727728        $replacement=$char;
    728729        }
     
    737738        my $replacement=$special_utf8_chars{$tex};
    738739        if (!defined($replacement)) {
    739         print STDERR "BibTexPlug: Warning: unknown latex accent \"$tex\" in \"$text\"\n";
     740        print STDERR "BibTexPlugin: Warning: unknown latex accent \"$tex\" in \"$text\"\n";
    740741        $replacement=$tex;
    741742        }
     
    749750          my $replacement=$special_utf8_chars{$tex};
    750751          if (!defined($replacement)) {
    751           print STDERR "BibTexPlug: Warning: unknown latex accent \"$tex\" in \"$text\"\n";
     752          print STDERR "BibTexPlugin: Warning: unknown latex accent \"$tex\" in \"$text\"\n";
    752753          $replacement=$char;
    753754      }
Note: See TracChangeset for help on using the changeset viewer.