summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMartin Gruner <mg.pub@gmx.net>2005-10-06 10:15:11 +0000
committerMartin Gruner <mg.pub@gmx.net>2005-10-06 10:15:11 +0000
commit87f638c6ee7f7f1bf27fffb50a60f765c40d6983 (patch)
tree6bd734cc330f24df2164dff685c869f566b9cd06 /modules
parent018c96b16ad1e8e594fc642db7ffaa37de41eeb9 (diff)
downloadsword-tools-87f638c6ee7f7f1bf27fffb50a60f765c40d6983.tar.gz
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@44 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules')
-rw-r--r--modules/mt-lxx-parallel/convert.pl129
1 files changed, 100 insertions, 29 deletions
diff --git a/modules/mt-lxx-parallel/convert.pl b/modules/mt-lxx-parallel/convert.pl
index 7858223..7ffff05 100644
--- a/modules/mt-lxx-parallel/convert.pl
+++ b/modules/mt-lxx-parallel/convert.pl
@@ -20,23 +20,40 @@ sub grabVerseContent(){ #Bookname, chapter, verse, @list
my $bookname = shift; my $chapter = shift; my $verse = shift; my @buffer = @_;
my $index=0;
-# unless ( grep(/^$bookname $chapter:$verse/, @buffer) ){ return; } #not found
- LOOP: foreach my $current_item (@buffer){
- if ($current_item =~ m/^$bookname $chapter:$verse/){
- while ( not $buffer[++$index] =~ m/^\n|^\s*$/ ){
- push(@result, $buffer[$index] );
+
+ 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, $buffer[$index] );
+ }
+ return @result;
}
- return @result;
+ $index++;
+ }
+ }
+ else{
+ LOOP: foreach my $current_item (@buffer){
+ if ($current_item =~ m/^$bookname $chapter:$verse/){
+ while ( not $buffer[++$index] =~ m/^\n|^\s*$/ ){
+ push(@result, $buffer[$index] );
+ }
+ return @result;
+ }
+ $index++;
}
- $index++;
}
return;
} #Nothing found, don't return a value.
sub processBook(){
-#bookname, filename
- my $bookname = shift;
+# File File id ThML id OSIS id Short Book Title
+
my $filename = shift;
+ my $bookname_infile = shift;
+ my $thml_id = shift;
+ my $osis_id = shift;
+ my $short_book_title = shift;
open( FILE, "$prefix/$filename") or die("Could not open file $prefix/$filename");
my @BUF = <FILE>; chomp(@BUF); close( FILE );
@@ -44,12 +61,17 @@ sub processBook(){
my @result;
CHAPTER: foreach my $chapter(1..1000){
- print("Processing $bookname chapter $chapter.\n");
+ print("Processing $bookname_infile chapter $chapter.\n");
my $verse_found;
VERSE: foreach my $verse(1..1000){
- my @verseContent = &grabVerseContent($bookname, $chapter, $verse, @BUF);
- if (@verseContent) {
- push(@result, "$bookname $chapter:$verse");
+ my @verseContent = &grabVerseContent($bookname_infile, $chapter, $verse, @BUF);
+ if (@verseContent) {
+ if ($bookname_infile eq "Obad"){
+ push(@result, "$osis_id $verse"); #chapter will be ignored for >1 by grabVerseContent
+ }
+ else{
+ push(@result, "$osis_id $chapter:$verse");
+ }
push(@result, @verseContent);
$verse_found = 1;
}
@@ -58,6 +80,7 @@ sub processBook(){
}
}
if (not $verse_found){ #chapter empty, stop here
+ if ($chapter == 1) { die("Error: no content in $bookname_infile"); }
last CHAPTER;
}
}
@@ -65,17 +88,19 @@ sub processBook(){
print("done.\n");
}
-sub processBookVariant(){
-#booknameA, filenameA, variantnameA,
-#booknameB, filenameB, variantnameB,
-#neutralBookName
- my $booknameA = shift;
+sub processBookVariant(){
+# FileA File_id_A VariantNameA FileB File_id_B VariantNameB ThML id OSIS id Short Book Title
+
my $filenameA = shift;
+ my $bookname_infile_A = shift;
my $variantNameA = shift;
- my $booknameB = shift;
my $filenameB = shift;
+ my $bookname_infile_B = shift;
my $variantNameB = shift;
- my $neutralBookname = shift;
+ my $thml_id = shift;
+ my $osis_id = shift;
+ my $short_book_title = shift;
+
# print("Processing $booknameA $filenameA $booknameB $filenameB $neutralBookname... \n");
open( FILE, "$prefix/$filenameA") or die("Could not open file $prefix/$filenameA");
@@ -87,13 +112,13 @@ sub processBookVariant(){
my @result;
CHAPTER: foreach my $chapter(1..1000){
- print("Processing $booknameA and $booknameB chapter $chapter.\n");
+ print("Processing $bookname_infile_A and $bookname_infile_B chapter $chapter.\n");
my $verse_found;
VERSE: foreach my $verse(1..1000){
- my @verseContentA = &grabVerseContent($booknameA, $chapter, $verse, @BUFA);
- my @verseContentB = &grabVerseContent($booknameB, $chapter, $verse, @BUFB);
+ my @verseContentA = &grabVerseContent($bookname_infile_A, $chapter, $verse, @BUFA);
+ my @verseContentB = &grabVerseContent($bookname_infile_B, $chapter, $verse, @BUFB);
if (@verseContentA or @verseContentB) {
- push(@result, "$neutralBookname $chapter:$verse");
+ push(@result, "$osis_id $chapter:$verse");
$verse_found = 1;
}
else{ #verse nonexistent, goto next chapter
@@ -110,6 +135,7 @@ sub processBookVariant(){
}
}
if (not $verse_found){ #chapter empty, stop here
+ if ($chapter == 1) { die("Error: no content in $bookname_infile_A and $bookname_infile_B"); }
last CHAPTER;
}
}
@@ -138,12 +164,57 @@ sub fixDaniel(){ #@buffer
}
my @result;
-#push(@result, &processBookVariant("JoshA", "07.JoshA.par", "Codex Alexandrinus:", "JoshB", "06.JoshB.par", "Codex Vaticanus:", "Josh") );
-#push(@result, &processBookVariant("JudgA", "09.JudgesA.par", "Codex Alexandrinus:", "JudgB", "08.JudgesB.par", "Codex Vaticanus:", "Judges") );
-push(@result, &processBook("Isa", "40.Isaiah.par") );
-#my @danielTmp = &processBookVariant("Dan", "45.DanielOG.par", "Old Greek:", "DanTh", "46.DanielTh.par", "Theodotion:", "Daniel");
-#push(@result, &fixDaniel( @danielTmp ) );
+ # 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("10.Ruth.par", "Ruth", "Ruth", "Ruth", "Ruth") );
+push(@result, &processBook("11.1Sam.par", "1Sam/K", "iSam", "1Sam", "1 Samuel") );
+push(@result, &processBook("12.2Sam.par", "2Sam/K", "iiSam", "2Sam", "2 Samuel") );
+push(@result, &processBook("13.1Kings.par", "1/3Kgs", "iKgs", "1Kgs", "1 Kings") );
+push(@result, &processBook("14.2Kings.par", "2/4Kgs", "iiKgs", "2Kgs", "2 Kings") );
+push(@result, &processBook("15.1Chron.par", "1Chr", "iChr", "1Chr", "1 Chronicles") );
+push(@result, &processBook("16.2Chron.par", "2Chr", "iiChr", "2Chr", "2 Chronicles") );
+push(@result, &processBook("18.Ezra.par", "Ezr", "Ezra", "Ezra", "Ezra") );
+push(@result, &processBook("19.Neh.par", "Neh", "Neh", "Neh", "Nehemiah") );
+push(@result, &processBook("18.Esther.par", "Esth", "Esth", "Esth", "Esther") );
+push(@result, &processBook("26.Job.par", "Job", "Job", "Job", "Job") );
+
+ #This might need special handling
+ #push(@result, &processBook("Psalms.par", "Ps", "Ps", "Ps", "Psalms",
+
+push(@result, &processBook("23.Prov.par", "Prov", "Prov", "Prov", "Proverbs") );
+push(@result, &processBook("24.Qoh.par", "Qoh", "Eccl", "Eccl", "Ecclesiastes") );
+push(@result, &processBook("25.Cant.par", "Song", "Song", "Song", "Song of Solomon") );
+push(@result, &processBook("40.Isaiah.par", "Isa", "Isa", "Isa", "Isaiah") );
+push(@result, &processBook("41.Jer.par", "Jer", "Jer", "Jer", "Jeremiah") );
+push(@result, &processBook("43.Lam.par", "Lam", "Lam", "Lam", "Lamentations") );
+push(@result, &processBook("44.Ezekiel.par", "Ezek", "Ezek", "Ezek", "Ezekiel") );
+
+my @danielTmp = &processBookVariant("45.DanielOG.par", "Dan", "Old Greek:", "46.DanielTh.par", "DanTh", "Theodotion:", "Dan", "Dan", "Daniel");
+push(@result, &fixDaniel( @danielTmp ) );
+
+push(@result, &processBook("28.Hosea.par", "Hos", "Hos", "Hos", "Hosea") );
+push(@result, &processBook("31.Joel.par", "Joel", "Joel", "Joel", "Joel") );
+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") );
+
print( join("\n", @result) );
+ \ No newline at end of file