scripts/exportvym
author insilmaril
Tue, 14 Mar 2006 14:27:16 +0000
changeset 245 27b71695d690
parent 37 df767ed748f3
permissions -rwxr-xr-x
hideLinkInExport for Branches (Floats still missing). Floats are now OrnamentedObj.
     1 #!/usr/bin/perl
     2 #
     3 # Script to convert vym files to arbitrary formats
     4 # Using xml stylesheets
     5 #
     6 # written by Uwe Drechsel	<vym@insilmaril.de>
     7 #
     8 
     9 my $version="0.1";
    10 my $PARSER="xsltproc";
    11 my $OUTDIR="";
    12 my $INPUTDIR="";
    13 my $XSL="vym2html.xsl";
    14 
    15 
    16 use Getopt::Long;
    17 GetOptions (
    18     "o=s" => \$opt_outdir,
    19 	"x=s"=> \$opt_xst,
    20     "h!" => \$opt_usage ) || usage ();
    21 
    22 
    23 
    24 if ($opt_usage) {
    25     $0 =~ s#.*/##g;
    26     print <<Helpende;
    27     
    28 exportvym	written by Uwe Drechsel - Version $version
    29 
    30 usage: $0 [-h] VYMFILE
    31 
    32 ...TODO...
    33 
    34 Helpende
    35 }
    36 
    37 
    38 if ($opt_xst) { $XST=$opt_XST; }
    39 if ($opt_outdir) { $OUTDIR="$opt_outdir/"; }
    40 if ($#ARGV <0) 
    41 {
    42 	die "not enough parameters given";
    43 } else
    44 {
    45 	# get MAPNAME
    46 	$MAPNAME=pop(@ARGV);
    47 	if ($MAPNAME=~/\//) 
    48 	{
    49 		# Get inputdir from path
    50 		$MAPNAME=~/(.*\/)(.*)/;
    51 		$INPUTDIR=$1;	
    52 		$MAPNAME=$2;	
    53 	}
    54 	if ($MAPNAME=~/(.*)(\.xml)/) { $MAPNAME=$1;}
    55 }
    56 
    57 transform();
    58 
    59 exit;
    60 
    61 ########################################################
    62 sub transform {
    63 ########################################################
    64 	my $command="$PARSER -o $OUTDIR$MAPNAME.html $XSL $INPUTDIR$MAPNAME.xml"; 
    65 	print "$command\n";
    66 	system ($command);
    67 }
    68 	
    69 
    70