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

Last change on this file since 9465 was 9465, checked in by kjdon, 19 years ago

ConvertToPlug now accepts the gli arg in read() and passes it in process(), and all the convert plugins now print a processing message for gli in their process() method.

  • 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 =
37 [ { 'name' => "process_exp",
38 'desc' => "{BasPlug.process_exp}",
39 'type' => "regexp",
40 'deft' => &get_default_process_exp(),
41 'reqd' => "no" } ];
42
43my $options = { 'name' => "WordPlug",
44 'desc' => "{WordPlug.desc}",
45 'abstract' => "no",
46 'inherits' => "yes",
47 'args' => $arguments };
48
49sub new {
50 my $class = shift (@_);
51
52 my $self = new ConvertToPlug ($class, @_);
53 $self->{'plugin_type'} = "WordPlug";
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 # wvWare will always produce html files encoded as utf-8
59 if ($self->{'input_encoding'} eq "auto") {
60 $self->{'input_encoding'} = "utf8";
61 $self->{'extract_language'} = 1;
62 }
63
64 return bless $self, $class;
65}
66
67sub get_default_process_exp {
68 my $self = shift (@_);
69
70 return q^(?i)\.(doc|dot)$^;
71}
72
73# do plugin specific processing of doc_obj for HTML type
74sub process {
75 my $self = shift (@_);
76 #my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
77
78 my $outhandle = $self->{'outhandle'};
79 print $outhandle "WordPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
80 if $self->{'verbosity'} > 1;
81 print STDERR "<Processing n='$_[3]' p='WordPlug'>\n" if ($_[6]);
82
83 return ConvertToPlug::process_type($self,"doc",@_);
84}
85
861;
Note: See TracBrowser for help on using the repository browser.