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

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

Jeffrey's new parsing modifications, committed approx 6 July, 15.16

  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 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 my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
52 push(@$pluginlist, $class);
53
54 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
55 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
56
57 my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
58
59 # wvWare will always produce html files encoded as utf-8
60 if ($self->{'input_encoding'} eq "auto") {
61 $self->{'input_encoding'} = "utf8";
62 $self->{'extract_language'} = 1;
63 }
64
65 return bless $self, $class;
66}
67
68sub get_default_process_exp {
69 my $self = shift (@_);
70
71 return q^(?i)\.(doc|dot)$^;
72}
73
74# do plugin specific processing of doc_obj for HTML type
75sub process {
76 my $self = shift (@_);
77 #my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
78
79 my $outhandle = $self->{'outhandle'};
80 print $outhandle "WordPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
81 if $self->{'verbosity'} > 1;
82 print STDERR "<Processing n='$_[3]' p='WordPlug'>\n" if ($_[6]);
83
84 return ConvertToPlug::process_type($self,"doc",@_);
85}
86
871;
Note: See TracBrowser for help on using the repository browser.