[sword-svn] r268 - trunk/modules/geneve

refdoc at crosswire.org refdoc at crosswire.org
Mon Jan 25 07:58:53 MST 2010


Author: refdoc
Date: 2010-01-25 07:58:53 -0700 (Mon, 25 Jan 2010)
New Revision: 268

Modified:
   trunk/modules/geneve/transform.pl
Log:
keywords and crossreferences


Modified: trunk/modules/geneve/transform.pl
===================================================================
--- trunk/modules/geneve/transform.pl	2010-01-13 08:41:29 UTC (rev 267)
+++ trunk/modules/geneve/transform.pl	2010-01-25 14:58:53 UTC (rev 268)
@@ -1,17 +1,46 @@
 #!/usr/bin/perl
 
+
 my @files=`ls -1 *.abw`;
 my @ident=`cat books`;
 
+
+
+
+
+
+
 foreach (@files){ 
 
+
+
+
         my @lines;
+        my %vs;
+        my %kw;
+        
 	chop;
 	open USFM, ">>$_.usfm";
 	chomp(@lines=`cat $_`);
+ 	@lines[1]="\\id @ident[$_-1] ";
 	
- 	@lines[1]="\\id @ident[$_-1] ";
+	open KW, "<$_.keywords";
+	open VS, "<$_.verse";
+	
 
+	while (<KW>) {	        
+	        my @content = split(/\|/,$_);
+	        chop($kw{@content[0]} = @content[1]); 	
+	}
+
+	while (<VS>) {
+	        
+	        my @content = split(/\|/,$_);
+	        $vs {@content[0]} = @content[1]; 	
+	}
+	
+
+
 	foreach (@lines) {
                 s/<m\ .*?\/m>//;
                 s/props\=\".*?\"//g;
@@ -19,9 +48,9 @@
 		s/<p\ style=\"Psalm Nr\".*?><c.*?>Psalm\ (.*?)<\/c><\/p>/\n\\c\ $1\n\\s1\ Psalm\ $1\n/g;
 		s/<c\ style=\"Verszahl\".*?>(.*?)<\/c>/\n\\v\ $1\ \ /g;
 		s/<p\ style=\"Buchtitel\".*?>/\n\\mt\ /g;
-		s/<p\ style=\"Bucheinleitung\".*?>/\n\\imt\n\\ip\ /g;
-		s/<p\ style=\"Spaltentitel\".*?>(.*?)<\/p>/\n\\s2\ $1\n\\p/g;
-		s/<p\ style=\"Spaltenparallelen\".*?>(.*?)<\/p>/\n\\r\ $1\n\\p/g;
+		s/<p\ style=\"Bucheinleitung\".*?>/\n\\imt\ Einleitung\n\\ip\ /g;
+		s/<p\ style=\"Spaltentitel\".*?>(.*?)<\/p>/\n\\s2\ $1\n\\p\ /g;
+		s/<p\ style=\"Spaltenparallelen\".*?>(.*?)<\/p>/\n\\r\ $1\n\\p\ /g;
 		s/<p style=\"Footnote Text\".*><field\ footnote-id=\".*?\"/\ \\f\ +\ /g;
 		s/<\/foot>/\\f\*\ /g;
 		s/type=\"footnote_anchor\"\ style=\"\"\ xid=\".*?\"\ >//g;                
@@ -33,11 +62,35 @@
 		        s/\]/\ \\add\*\ /g;
 		        }
 		s/<p\ style=\"Kopfzeile\".*?p>//;
+		
+		s/<c\ style=\"Verweiswort\".*?><\/c>//g;
+		s/<c\ style=\"Verweiswort\".*?>(.*?)<\/c>/$1\ \\x\ \\xk\ $1\\x\*\ /g;
+		
 		s/xid\=\".*?\"//g;
                 s/<.*?>//g;
+#                s/$/\n/;
 			              
 	}
+	@lines=split("\n",join("", at lines));
 	
+	my $chapter, $verse=0;
+	
+	foreach (@lines) {
+	
+	        if (/\\c\s+([0-9]+)\s/) {
+	                $chapter=$1;
+	        }
+	        if (/\\v\s+([0-9]+)\s/) {
+	                $verse=$1;
+                        s/$/$vs{$chapter.":".$verse}/e;
+	        
+	        }
+	        
+	        s/\\x\s+\\xk\s+(.+?)\s*\\x\*/$kw{$chapter.":".$verse.":".substr($1,0,4)}/eg;
+	        s/$/\n/;        
+	        
+	}
+	
 	print (USFM @lines);
 	close USFM;
 }                                                                                  




More information about the sword-cvs mailing list