source: trunk/gsdl/perllib/plugins/WordPlug.pm@ 3540

Last change on this file since 3540 was 3540, checked in by kjdon, 22 years ago

added John T's changes into CVS - added info to enable retrieval of usage info in xml

  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1###########################################################################
2#
3# WordPlug.pm -- plugin for importing Microsoft Word documents
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26# 12/05/02 Added usage datastructure - John Thompson
27
28package WordPlug;
29
30use ConvertToPlug;
31
32sub BEGIN {
33 @ISA = ('ConvertToPlug');
34}
35
36my $arguments = [ { 'name' => "process_exp",
37 'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. Each plugin has its own default process_exp. e.g HTMLPlug defaults to '(?i)\.html?\$' i.e. all documents ending in .htm or .html (case-insensitive).",
38 'type' => "string",
39 'deft' => q^(?i)\.doc$^,
40 'reqd' => "no" } ];
41
42my $options = { 'name' => "WordPlug",
43 'desc' => "",
44 'inherits' => "yes",
45 'args' => $arguments };
46
47sub new {
48 my $class = shift (@_);
49
50 my $self = new ConvertToPlug ($class, @_);
51
52 # 14-05-02 To allow for proper inheritance of arguments - John Thompson
53 my $option_list = $self->{'option_list'};
54 push( @{$option_list}, $options );
55
56 # wvWare will always produce html files encoded as utf-8
57 if ($self->{'input_encoding'} eq "auto") {
58 $self->{'input_encoding'} = "utf8";
59 $self->{'extract_language'} = 1;
60 }
61
62 return bless $self, $class;
63}
64
65sub get_default_process_exp {
66 my $self = shift (@_);
67
68 return q^(?i)\.(doc|dot)$^;
69}
70
71# do plugin specific processing of doc_obj for HTML type
72sub process {
73 my $self = shift (@_);
74
75 my $outhandle = $self->{'outhandle'};
76 print $outhandle "WordPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
77 if $self->{'verbosity'} > 1;
78
79 return ConvertToPlug::process_type($self,"doc",@_);
80}
81
821;
Note: See TracBrowser for help on using the repository browser.