File: exportvym

package info (click to toggle)
vym 1.10.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,376 kB
  • ctags: 1,926
  • sloc: cpp: 18,468; xml: 277; sh: 211; perl: 89; makefile: 26
file content (70 lines) | stat: -rwxr-xr-x 1,147 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl
#
# Script to convert vym files to arbitrary formats
# Using xml stylesheets
#
# written by Uwe Drechsel	<vym@insilmaril.de>
#

my $version="0.1";
my $PARSER="xsltproc";
my $OUTDIR="";
my $INPUTDIR="";
my $XSL="vym2html.xsl";


use Getopt::Long;
GetOptions (
    "o=s" => \$opt_outdir,
	"x=s"=> \$opt_xst,
    "h!" => \$opt_usage ) || usage ();



if ($opt_usage) {
    $0 =~ s#.*/##g;
    print <<Helpende;
    
exportvym	written by Uwe Drechsel - Version $version

usage: $0 [-h] VYMFILE

...TODO...

Helpende
}


if ($opt_xst) { $XST=$opt_XST; }
if ($opt_outdir) { $OUTDIR="$opt_outdir/"; }
if ($#ARGV <0) 
{
	die "not enough parameters given";
} else
{
	# get MAPNAME
	$MAPNAME=pop(@ARGV);
	if ($MAPNAME=~/\//) 
	{
		# Get inputdir from path
		$MAPNAME=~/(.*\/)(.*)/;
		$INPUTDIR=$1;	
		$MAPNAME=$2;	
	}
	if ($MAPNAME=~/(.*)(\.xml)/) { $MAPNAME=$1;}
}

transform();

exit;

########################################################
sub transform {
########################################################
	my $command="$PARSER -o $OUTDIR$MAPNAME.html $XSL $INPUTDIR$MAPNAME.xml"; 
	print "$command\n";
	system ($command);
}