[sword-svn] r164 - trunk/versification

chrislit at crosswire.org chrislit at crosswire.org
Thu Mar 12 04:10:36 MST 2009


Author: chrislit
Date: 2009-03-12 04:10:36 -0700 (Thu, 12 Mar 2009)
New Revision: 164

Modified:
   trunk/versification/v11nsys.pl
Log:
extended v11n system converter to derive a v11n definition from a VPL file

Modified: trunk/versification/v11nsys.pl
===================================================================
--- trunk/versification/v11nsys.pl	2009-03-12 10:25:44 UTC (rev 163)
+++ trunk/versification/v11nsys.pl	2009-03-12 11:10:36 UTC (rev 164)
@@ -58,15 +58,34 @@
     close (MAP);
 }
 
-opendir (DIR, ".");
- at srcfiles = grep /Bible\.[^\.]+\.xml$/, readdir DIR;
-closedir(DIR);
+if (@ARGV[0] ne "") {
+    $n = 0;
+    while (@ARGV[$n] ne "") {
+	push @srcfiles, @ARGV[$n];
+	$n++;
+    }
+    $vplStyle = true;
+}
+else {
+    opendir (DIR, ".");
+    @srcfiles = grep /Bible\.[^\.]+\.xml$/, readdir DIR;
+    closedir(DIR);
+    $vplStyle = false;
+}
 
 foreach $infile (@srcfiles) {
     
-    $infile =~ /Bible\.([^\.]+)\.xml/;
-    $v11n = $1;
-    $outfile = lc("v11n$1.h");
+    if ($infile =~ /^Bible.+xml$/) {
+	$infile =~ /^Bible\.([^\.]+)\.xml/;
+	$v11n = $1;
+	$outfile = lc("v11n$1.h");
+    }
+    else {
+	$v11n = $infile;
+	$v11n =~ s/\.[^\.]*$//;
+	$v11n =~ s/^.+\///;
+	$outfile = lc("v11n$v11n.h");
+    }
 
     open INF, $infile;
     open OUTF, ">$outfile";
@@ -94,9 +113,17 @@
 	
 	$line = cleanupLine($line);
 	
+	$osisID = "";
+
 	if ($line =~ /<osisID.+?code=\"(.+?)\"\/>/) {
 	    $osisID = $1;
-	    
+	}
+	elsif ($vplStyle == true && $line =~ /^([^ ]+ [^ :]+:[^ :]+)/) {
+	    $osisID = $1;
+	    $osisID =~ s/[ :]/\./g;
+	}
+
+	if ($osisID ne "") {
 	    $lastBook = $thisBook;
 	    $lastChap = $thisChap;
 	    $lastVers = $thisVers;




More information about the sword-cvs mailing list