1 | ###########################################################################
|
---|
2 | #
|
---|
3 | # RTFPlug.pm -- plugin for importing Rich Text Format files.
|
---|
4 | #
|
---|
5 | # A component of the Greenstone digital library software
|
---|
6 | # from the New Zealand Digital Library Project at the
|
---|
7 | # University of Waikato, New Zealand.
|
---|
8 | #
|
---|
9 | # Copyright (C) 2001 New Zealand Digital Library Project
|
---|
10 | #
|
---|
11 | # This program is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # This program is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with this program; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
24 | #
|
---|
25 | ###########################################################################
|
---|
26 |
|
---|
27 | # 12/05/02 Added usage datastructure - John Thompson
|
---|
28 |
|
---|
29 | package RTFPlug;
|
---|
30 |
|
---|
31 | use ConvertToPlug;
|
---|
32 |
|
---|
33 | sub BEGIN {
|
---|
34 | @ISA = ('ConvertToPlug');
|
---|
35 | }
|
---|
36 |
|
---|
37 | my $arguments =
|
---|
38 | [ { 'name' => "process_exp",
|
---|
39 | 'desc' => "{BasPlug.process_exp}",
|
---|
40 | 'type' => "regexp",
|
---|
41 | 'deft' => &get_default_process_exp(),
|
---|
42 | 'reqd' => "no" } ];
|
---|
43 |
|
---|
44 | my $options = { 'name' => "RTFPlug",
|
---|
45 | 'desc' => "{RTFPlug.desc}",
|
---|
46 | 'abstract' => "no",
|
---|
47 | 'inherits' => "yes",
|
---|
48 | 'args' => $arguments };
|
---|
49 |
|
---|
50 | sub new {
|
---|
51 | my $class = shift (@_);
|
---|
52 | my $self = new ConvertToPlug ($class, @_);
|
---|
53 | $self->{'plugin_type'}="RTFPlug";
|
---|
54 | # 14-05-02 To allow for proper inheritance of arguments - John Thompson
|
---|
55 | my $option_list = $self->{'option_list'};
|
---|
56 | push( @{$option_list}, $options );
|
---|
57 |
|
---|
58 | return bless $self, $class;
|
---|
59 | }
|
---|
60 |
|
---|
61 | sub get_default_process_exp {
|
---|
62 | my $self = shift (@_);
|
---|
63 | return q^(?i)\.rtf$^;
|
---|
64 | }
|
---|
65 |
|
---|
66 | sub process {
|
---|
67 | my $self = shift (@_);
|
---|
68 |
|
---|
69 | my $outhandle = $self->{'outhandle'};
|
---|
70 | print $outhandle "RTFPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
|
---|
71 | if $self->{'verbosity'} > 1;
|
---|
72 | print STDERR "<Processing n='$_[3]' p='RTFPlug'>\n" if ($_[6]);
|
---|
73 |
|
---|
74 | return ConvertToPlug::process_type($self,"rtf",@_);
|
---|
75 | }
|
---|
76 |
|
---|
77 | 1;
|
---|