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

refdoc at crosswire.org refdoc at crosswire.org
Mon Jan 25 08:03:28 MST 2010


Author: refdoc
Date: 2010-01-25 08:03:28 -0700 (Mon, 25 Jan 2010)
New Revision: 271

Modified:
   trunk/modules/geneve/paralist.pl
Log:
keywords and parallels


Modified: trunk/modules/geneve/paralist.pl
===================================================================
--- trunk/modules/geneve/paralist.pl	2010-01-25 15:02:12 UTC (rev 270)
+++ trunk/modules/geneve/paralist.pl	2010-01-25 15:03:28 UTC (rev 271)
@@ -1,26 +1,29 @@
 #!/usr/bin/perl
-use strict;
 
 my @files=`ls -1 *.abw`;
+my @ident=`cat books`;
 
 foreach (@files){ 
 
         my @lines;
 	chop;
-	open PARA, ">>$_.list";
+	open KW, ">>$_.keywords";
+	open USFM, ">>$_.usfm";
+	open VS, ">>$_.verse";
 	chomp(@lines=`cat $_`);
 	
+ 	@lines[1]="\\id @ident[$_-1] ";
 
 	foreach (@lines) {
                 s/<m\ .*?\/m>//;
                 
-		s/<p\ style=\"Parallelen [Ü]*bers Kapitel\".*?><c.*?>\ *[K|P]\ (.*?)<\/c><\/p>//g;
+		s/<p\ style=\"Parallelen [Ü]*bers Kapitel\".*?><c.*?>\ *[K|P]\ (.*?)<\/c><\/p>/\n\n\\c\ $1\ /g;
 
                 s/<p\ style=\"Parallelenverweise\" xid=\"[0-9]+\"\ props=\"text-align:left; line-height:1.0; dom-dir:ltr; orphans:0; widows:0\"><\/p>//g;
  
                 s/<p\ style=\"Parallelenverweise\" xid=\"[1-7]\".+?><c.+?>.*?<\/c><\/p>//g;
                 s/<p style=\"Parallelenverweise\".*?>(.*?)<\/p>/\n$1\ \\x\*/g;
-		s/<c style=\"Verszahl\ Parallelensignal\".*?>(.*?)<\/c>//g;
+		s/<c style=\"Verszahl\ Parallelensignal\".*?>(.*?)<\/c>/\\v\ $1\ \ /g;
 		s/<c style=\"Parallelentext Leerz\".*?>\ <\/c>/\ \\x\ /g;
 		s/<c style=\"Parallelentext kursiv\".*?>(.*?)<\/c>/\ \\xk\ $1\ /g;
 		s/<c .*?props=\"lang:de-DE;\ font-size:8pt;\ font-family:(Utopia|Times\ New\ Roman)\".*?>(.*?)<\/c>/\ \\xt\ $2/g;
@@ -30,12 +33,58 @@
 		s/xid\=\".*?\"//g;
 		s/^\ x\*//;
                 s/<.*?>//g;
-                s/(\\xt.*?)(\\xk)/$1\ \\x\*\n\\x\ $2/g;
-                s/^\ //g;
-                s/\n\ /\n/g;
-                s/\ \ +/\ /g;
+                s/(\\xt.*?)(\\xk)/$1\ \\x\*\ \\x\ $2/g;
+                
+
 }
-	
-	print (PARA @lines);
-	close PARA;
+        $book = join ("", @lines);	
+        
+        @lines = split("\n",$book);
+        
+        my $chapter, $verse =1;
+
+        foreach (@lines) {
+                
+                if (/^\\c\ ([0-9]+)\ /) {
+                        
+                        $chapter=$1;
+                        }
+                         
+                if (/^\\v\ ([0-9]+)\ /) {
+                        
+                        $verse=$1;
+                        }
+                        
+                s/^\\v\ ([0-9]+)\ /$chapter.":".$verse."|"/e;
+                s/\\x\*\ \\x\ /\\x\*\n$chapter:$verse\|\ \\x\ /g;
+                s/\ (\\x\ +\\xk)\ +(.*?)(\\xt)/":".substr($2,0,4)."\| ".$1." ".$2.$3/eg;
+                s/$/\n/;
+                }
+
+        @lines=split("\n",join("", at lines));
+        
+        foreach (@lines) {
+                s/\\c\ .*?$//;
+                s/^\s*$//;
+                s/\ :/:/;
+                s/\s+\|/\|/;
+                s/\|:/:/; 
+                s/\ +/\ /;
+                s/$/\n/;
+                }
+
+
+        foreach (@lines) {
+        
+                if (/^[0-9]+:[0-9]+\|/) {
+                        print (VS $_);
+                        }
+                elsif (/^[0-9]+:[0-9]+:/) {
+                        print (KW $_);
+                        }
+                else {print (USFM $_);}
+                }                        
+
+#	print (USFM @lines);
+	close USFM,VS,KW;
 }                                                                                  




More information about the sword-cvs mailing list