[sword-svn] r58 - trunk/modules/mt-lxx-parallel

mgruner at crosswire.org mgruner at crosswire.org
Thu Dec 15 13:09:37 MST 2005


Author: mgruner
Date: 2005-12-15 13:09:28 -0700 (Thu, 15 Dec 2005)
New Revision: 58

Modified:
   trunk/modules/mt-lxx-parallel/convert.pl
Log:
further progress


Modified: trunk/modules/mt-lxx-parallel/convert.pl
===================================================================
--- trunk/modules/mt-lxx-parallel/convert.pl	2005-12-05 18:33:35 UTC (rev 57)
+++ trunk/modules/mt-lxx-parallel/convert.pl	2005-12-15 20:09:28 UTC (rev 58)
@@ -306,7 +306,7 @@
 			&translateHebrewLetters( uc( $1 ) ) . "/" . &translateHebrewLetters( uc( $2 ) ) .
 			") between MT and the presumed Hebrew parent text of the LXX.") );
 
-	($origNote =~ m/^\[(.+)\]/) and 
+	($origNote =~ m/^\[([^\]]+)\]/) and 
 		return( &createNote( "Number of verse in LXX ($1) is different from MT." ) );
 
 	#special case: no note, but a crossref (no book ID)     # TODO: for now OSIS refs are not parsed FIX THIS, see above
@@ -409,29 +409,32 @@
 
 	($notes{ $origNote }) and return( &createNote( $notes{$origNote} ) );
 
-	($origNote =~ m/^\[(.+)\]?/) and 
+	($origNote =~ m/^\[\[([^\]]+)\]\]/) and 
+		return( &createNote( "Number of verse in MT ($1) is different from the LXX." ) );
+
+	($origNote =~ m/^\[([^\]]+)\]?/) and 
 		return( &createNote( "Number of verse in LXX ($1) is different from MT." ) );
 
-	($origNote =~ m/^\[\[(.+)\]\]/) and 
-		return( &createNote( "Number of verse in MT ($1) is different from the LXX." ) );
-
 	#special case: no note, but a crossref (no book ID)     # TODO: for now OSIS refs are not parsed FIX THIS, see above
  	($origNote =~ m/^\[\[|\]\]$/) and
 		return $origNote;
 
 	#special case: no note, but a crossref (no book ID)     # TODO: for now OSIS refs are not parsed FIX THIS, see above
- 	($origNote =~ m/^\[.+$|\d+\]$/) and     #e.g. [119. 7], [111.2
+ 	($origNote =~ m/^\[[^\]]+$|\d+\]$/) and     #e.g. [119. 7], [111.2
 		return $origNote;
 
 	($origNote =~ m/^=?{\.\.\.(.+)\.\.\.(.+)}/) and  # special case: {...word1...word2}
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{...}" })
 			. &createNote("(".&translateGreekWordorNote( $2 ).") ". $notes{ "{...}" })); 
 
+	($origNote =~ m/^=?{\.\.\.p(.+)}/) and 
+		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{...p}" }) );
+
 	($origNote =~ m/^=?{\.\.p(.+)}/) and 
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..p}" }) );
 
-	($origNote =~ m/^=?{\.\.\.p(.+)}/) and 
-		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{...p}" }) );
+	($origNote =~ m/^=?{\.\.~(.+)}/) and 
+		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..~}" }) );
 
 	($origNote =~ m/^=?{\.\.\.r(.+)}/) and 
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..r}" }) );
@@ -448,6 +451,12 @@
 	($origNote =~ m/^=?{\.\.\.d(.+)}/) and # TODO: my addition, check
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..d}" }) );
 
+	($origNote =~ m/^=?{\.\.\.\.(.+)}/) and 
+		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{....}" }) );
+
+	($origNote =~ m/^=?{\.\.\.(.+)}/) and 
+		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{...}" }) );
+
 	($origNote =~ m/^=?{\.\.(.+)}/) and 
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..}" }) );
 
@@ -504,8 +513,6 @@
 	die("Note $origNote not found.\n");
 }
 
-
-
 sub translateHebrewWordorNote(){ #will return unicode hebrew with morph separation
 	my $hebrew = shift;
 
@@ -573,6 +580,8 @@
 	return $result;
 }
 
+my $colBContent;
+
 sub parseLine(){
 	my $origLine = shift;
 	my $result;
@@ -634,7 +643,10 @@
 	$result .= "</cell>\n  <cell>";
 
 	foreach my $wordB (@hebrewWordsColB){
-		($wordB) and $result .= &translateHebrewWordorNote( $wordB ) . " ";
+		if ($wordB) {
+			$result .= &translateHebrewWordorNote( $wordB ) . " ";
+			$colBContent = 1;
+		}
 	}
 	$result .= "</cell>\n  <cell>";
 
@@ -642,10 +654,14 @@
 		($wordG) and $result .= &translateGreekWordorNote( $wordG ). " ";
 	}
 	$result .= "</cell>\n</row>";
+
 #  	printf("Result: %s\n", $result);
 	return $result;
 }
 
+my $headerWithColB =     "<row>\n  <cell>MT</cell><cell>(LXX)</cell><cell>LXX</cell>\n</row>";
+my $headerWithoutColB  = "<row>\n  <cell>MT</cell><cell></cell><cell>LXX</cell>\n</row>";
+
 #
 # grabVerseContent - if the Verse can be found, returns its Content, otherwise nothing
 #
@@ -657,12 +673,21 @@
 
 #	printf("Parsing $bookname $chapter:$verse...\n");
 
+	$colBContent = undef;
+	my @tmp;
+
 	if ($bookname eq "Obad"){ #special handling, no chapter:verse structure
 		LOOP: foreach my $current_item (@buffer){
 			if ($chapter == 1 and $current_item =~ m/^$bookname $verse/){ #only for the first chapter
 				while ( not $buffer[++$index] =~ m/^\n|^\s*$/ ){
-					push(@result, &parseLine( $buffer[$index] ) );
+					push(@tmp, &parseLine( $buffer[$index] ) );
 				}
+				if ($colBContent){
+					push(@result, $headerWithColB, @tmp)
+				}
+				else{
+					push(@result, $headerWithoutColB, @tmp)
+				}
 				return @result;
 			}
 			$index++;
@@ -672,8 +697,14 @@
 		LOOP: foreach my $current_item (@buffer){
 			if ($current_item =~ m/^$bookname $chapter:$verse/){
 				while ( not $buffer[++$index] =~ m/^\n|^\s*$/ ){
-					push(@result, &parseLine( $buffer[$index] ) );
+					push(@tmp, &parseLine( $buffer[$index] ) );
 				}
+				if ($colBContent){
+					push(@result, $headerWithColB, @tmp)
+				}
+				else{
+					push(@result, $headerWithoutColB, @tmp)
+				}
 				return @result;
 			}
 			$index++;
@@ -765,8 +796,11 @@
 		my $chapter_header_written;
 		my $verse_found;
 		VERSE: foreach my $verse(1..1000){
+			my $colBcontentTMP;
 			my @verseContentA = &grabVerseContent($bookname_infile_A, $chapter, $verse, @BUFA);
+			($colBContent) and $colBcontentTMP = 1;
 			my @verseContentB = &grabVerseContent($bookname_infile_B, $chapter, $verse, @BUFB);
+			($colBContent) and $colBcontentTMP = 1;
 			if (@verseContentA or @verseContentB) { 
 				if (not $chapter_header_written) { 
 					push(@result, "<chapter osisID=\"$osis_id.$chapter\">");
@@ -780,13 +814,14 @@
 				last VERSE;
 			}
 			if (@verseContentA){
-				if (@verseContentB){ push(@result, $variantNameA) };
-				push(@result, "<table>", @verseContentA, "</table");
-				if (@verseContentB){ push(@result, "") }; #newline
+				if (@verseContentB){ push(@result, "<table><row><cell>" . $variantNameA ."\n") };
+				push(@result, "<table>", @verseContentA, "</table>");
+				if (@verseContentB){ push(@result, "</cell><cell>") };
 			}
 			if (@verseContentB){
-				if (@verseContentA){ push(@result, $variantNameB) };
+				if (@verseContentA){ push(@result, $variantNameB . "\n") };
 				push(@result, "<table>", @verseContentB, "</table>");
+				if (@verseContentA){ push(@result, "</cell></row></table>") };
 			}
 			if ($verse_found){ push(@result, "</verse>") }
 		}
@@ -888,13 +923,13 @@
 </header>\n");
 
 	# File				File id			ThML id		OSIS id		Short Book Title
-# push(@result, &processBook("01.Genesis.par", "Gen", "Gen", "Gen", "Genesis") );
-# push(@result, &processBook("02.Exodus.par", "Exod", "Exod", "Exod", "Exodus") );
-# push(@result, &processBook("03.Lev.par", "Lev", "Lev", "Lev", "Leviticus") );
-# push(@result, &processBook("04.Num.par", "Num", "Num", "Num", "Numbers") );
-# push(@result, &processBook("05.Deut.par", "Deut", "Deut", "Deut", "Deuteronomy") );
-# push(@result, &processBookVariant("07.JoshA.par", "JoshA", "Codex Alexandrinus:", "06.JoshB.par", "JoshB", "Codex Vaticanus:", "Josh", "Josh", "Joshua") );
-# push(@result, &processBookVariant("09.JudgesA.par", "JudgA", "Codex Alexandrinus:", "08.JudgesB.par", "JudgB", "Codex Vaticanus:", "Judg", "Judg", "Judges") );
+push(@result, &processBook("01.Genesis.par", "Gen", "Gen", "Gen", "Genesis") );
+push(@result, &processBook("02.Exodus.par", "Exod", "Exod", "Exod", "Exodus") );
+push(@result, &processBook("03.Lev.par", "Lev", "Lev", "Lev", "Leviticus") );
+push(@result, &processBook("04.Num.par", "Num", "Num", "Num", "Numbers") );
+push(@result, &processBook("05.Deut.par", "Deut", "Deut", "Deut", "Deuteronomy") );
+push(@result, &processBookVariant("07.JoshA.par", "JoshA", "Codex Alexandrinus:", "06.JoshB.par", "JoshB", "Codex Vaticanus:", "Josh", "Josh", "Joshua") );
+ push(@result, &processBookVariant("09.JudgesA.par", "JudgA", "Codex Alexandrinus:", "08.JudgesB.par", "JudgB", "Codex Vaticanus:", "Judg", "Judg", "Judges") );
   
 # push(@result, &processBook("10.Ruth.par", "Ruth", "Ruth", "Ruth", "Ruth") );
 # push(@result, &processBook("11.1Sam.par", "1Sam/K", "iSam", "1Sam", "1 Samuel") );
@@ -925,13 +960,13 @@
 # push(@result, &processBook("30.Amos.par", "Amos", "Amos", "Amos", "Amos") );
 # push(@result, &processBook("33.Obadiah.par", "Obad", "Obad", "Obad", "Obadiah") );
  push(@result, &processBook("32.Jonah.par", "Jonah", "Jonah", "Jonah", "Jonah") );
-# push(@result, &processBook("29.Micah.par", "Mic", "Mic", "Mic", "Micah") );
-# push(@result, &processBook("34.Nahum.par", "Nah", "Nah", "Nah", "Nahum") );
-# push(@result, &processBook("35.Hab.par", "Hab", "Hab", "Hab", "Habakkuk") );
-# push(@result, &processBook("36.Zeph.par", "Zeph", "Zeph", "Zeph", "Zephaniah") );
-# push(@result, &processBook("37.Haggai.par", "Hag", "Hag", "Hag", "Haggai") );
-# push(@result, &processBook("38.Zech.par", "Zech", "Zech", "Zech", "Zechariah") );
-# push(@result, &processBook("39.Malachi.par", "Mal", "Mal", "Mal", "Malachi") );
+ push(@result, &processBook("29.Micah.par", "Mic", "Mic", "Mic", "Micah") );
+ push(@result, &processBook("34.Nahum.par", "Nah", "Nah", "Nah", "Nahum") );
+ push(@result, &processBook("35.Hab.par", "Hab", "Hab", "Hab", "Habakkuk") );
+ push(@result, &processBook("36.Zeph.par", "Zeph", "Zeph", "Zeph", "Zephaniah") );
+ push(@result, &processBook("37.Haggai.par", "Hag", "Hag", "Hag", "Haggai") );
+ push(@result, &processBook("38.Zech.par", "Zech", "Zech", "Zech", "Zechariah") );
+ push(@result, &processBook("39.Malachi.par", "Mal", "Mal", "Mal", "Malachi") );
 
 push(@result, "</osisText>\n</osis>");
 



More information about the sword-cvs mailing list