[1410] | 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 |
|
---|
[3540] | 26 | # 12/05/02 Added usage datastructure - John Thompson
|
---|
| 27 |
|
---|
[1410] | 28 | package WordPlug;
|
---|
| 29 |
|
---|
| 30 | use ConvertToPlug;
|
---|
| 31 |
|
---|
| 32 | sub BEGIN {
|
---|
| 33 | @ISA = ('ConvertToPlug');
|
---|
| 34 | }
|
---|
| 35 |
|
---|
[3540] | 36 | my $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 |
|
---|
| 42 | my $options = { 'name' => "WordPlug",
|
---|
| 43 | 'desc' => "",
|
---|
| 44 | 'inherits' => "yes",
|
---|
| 45 | 'args' => $arguments };
|
---|
| 46 |
|
---|
[2811] | 47 | sub new {
|
---|
| 48 | my $class = shift (@_);
|
---|
| 49 |
|
---|
| 50 | my $self = new ConvertToPlug ($class, @_);
|
---|
| 51 |
|
---|
[3540] | 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 |
|
---|
[2811] | 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 |
|
---|
[1410] | 65 | sub get_default_process_exp {
|
---|
| 66 | my $self = shift (@_);
|
---|
| 67 |
|
---|
[3400] | 68 | return q^(?i)\.(doc|dot)$^;
|
---|
[1410] | 69 | }
|
---|
| 70 |
|
---|
| 71 | # do plugin specific processing of doc_obj for HTML type
|
---|
| 72 | sub process {
|
---|
| 73 | my $self = shift (@_);
|
---|
[2515] | 74 |
|
---|
| 75 | my $outhandle = $self->{'outhandle'};
|
---|
[3540] | 76 | print $outhandle "WordPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
|
---|
[1410] | 77 | if $self->{'verbosity'} > 1;
|
---|
| 78 |
|
---|
| 79 | return ConvertToPlug::process_type($self,"doc",@_);
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | 1;
|
---|