LDP/LDP/wt2db/wt2db

69 lines
1.6 KiB
Plaintext
Raw Normal View History

2002-02-02 04:47:19 +00:00
#!/usr/bin/perl
#
2002-05-05 21:56:12 +00:00
#Converts txt files into DocBook XML/SGML.
2002-02-02 04:47:19 +00:00
#
2002-05-25 16:14:15 +00:00
$VERSION = '0.4-cvs';
2002-05-01 17:59:52 +00:00
use Wt2Db;
$WT2DB = new Wt2Db;
2002-02-02 04:47:19 +00:00
my $txtfile = '';
my $dbfile = '';
my $verbose = 0;
my $error = 0;
2002-02-02 04:47:19 +00:00
# read in cmd-line arguments
#
while (1) {
if($ARGV[0] eq "-a" or $ARGV[0] eq "--article") {
$article = 1;
shift(@ARGV);
} elsif($ARGV[0] eq "-o" or $ARGV[0] eq "--output-to") {
2002-02-02 04:47:19 +00:00
shift(@ARGV);
$dbfile = $ARGV[0];
shift(@ARGV);
} elsif($ARGV[0] eq "-V" or $ARGV[0] eq "--verbose") {
2002-02-02 04:47:19 +00:00
$verbose++;
shift(@ARGV);
} elsif($ARGV[0] eq "-v" or $ARGV[0] eq "--version") {
&version();
exit(0);
} elsif($ARGV[0] eq "-h" or $ARGV[0] eq "--help") {
&usage();
2002-02-02 04:47:19 +00:00
} else {
$txtfile = $ARGV[0];
shift(@ARGV);
}
if ($ARGV[0] eq '') {
last;
}
}
$WT2DB->ProcessFile($txtfile, $dbfile, $verbose, $article);
sub version {
print "wt2db version $VERSION\n";
print "Copyright (c) 2001, 2002 David Merrill \<david\@lupercalia.net\>.\n";
print "\n";
2002-05-05 21:56:12 +00:00
print "Converts a WikiText file into DocBook XML/SGML.\n";
print "\n";
print "This is free software; see the source for copying conditions. There is no\n";
print "warranty; not even for merchantability or fitness for a particular purpose.\n";
}
sub usage {
my $error = shift;
&version;
print "Usage: wt2db [OPTIONS] [FILE]\n";
print "\n";
print "Options:\n";
print "-a, --article add DOCTYPE and article tags.\n";
print "-o, --output-to write to the specified file.\n";
print "-v, --verbose show diagnostic output.\n";
print "-V, --version show program version.\n";
print "-h, --help show this usage message.\n";
exit($error);
}