-
Notifications
You must be signed in to change notification settings - Fork 0
/
MediaWikiToTWikiAddOn.pm
90 lines (80 loc) · 2.61 KB
/
MediaWikiToTWikiAddOn.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright (C) 2006-2007 Michael Daum http://wikiring.de
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details, published at
# http://www.gnu.org/copyleft/gpl.html
package TWiki::Contrib::MediaWikiToTWikiAddOn;
use strict;
use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION );
$VERSION = '$Rev$';
$RELEASE = 'v1.0';
$SHORTDESCRIPTION = 'MediaWiki 2 TWiki Conversion Tool';
use Getopt::Long;
use Pod::Usage;
use TWiki::Contrib::MediaWikiToTWikiAddOn::Converter;
##############################################################################
sub main {
my $help = 0;
my %args = (
debug => 0,
debug => 0,
defaultWeb=>'_default',
dry => 0,
cumulative => 0,
excludePattern => '',
fileName => '',
images=>'',
includePattern => '',
language => 'en',
match=> '',
maxPages => 0,
namespace => '',
plugin=>'',
targetWeb => 'MediaWiki',
topicMapString => '',
webMapString => '',
);
GetOptions(
"debug|d+" => \$args{debug},
"dry" => \$args{dry},
"cumulative" => \$args{cumulative},
"file|f:s" => \$args{fileName},
"help|?" => \$help,
"max|m:i" => \$args{maxPages},
"web:s" => \$args{targetWeb},
"exclude:s" => \$args{excludePattern},
"include:s" => \$args{includePattern},
"match:s" => \$args{matchPattern},
"cat:s" => \$args{catPattern},
"lang:s" => \$args{language},
"namespace|n:s" => \$args{namespace},
"webmap:s" => \$args{webMapString},
"topicmap:s" => \$args{topicMapString},
"language:s" => \$args{language},
"images:s" => \$args{images},
"defaultweb:s" => \$args{defaultWeb},
"plugin:s" => \$args{plugin},
) or pod2usage(2);
unless (defined
$TWiki::Contrib::MediaWikiToTWikiAddOn::Converter::language{$args{language}}) {
print STDERR "ERROR: unknown language $args{language}. Known languages are: ".
join(', ', sort keys %TWiki::Contrib::MediaWikiToTWikiAddOn::language).
"\n";
exit;
}
pod2usage(-exitval =>1,
-verbose=>2,
-message => "\nThe MEDIAWIKI 2 TWiki Conversion Tool\n"
) if $help;
my $converter = TWiki::Contrib::MediaWikiToTWikiAddOn::Converter->new(%args);
#$converter->writeInfo();
$converter->convert();
}
1;