From 8f05cd67a6f61ea992a5d656f1d00e25467ab01c Mon Sep 17 00:00:00 2001 From: Chris Little Date: Sat, 14 Mar 2009 08:44:58 +0000 Subject: finished integrating all canon.h book abbreviations (& correlates in other collections) added ability to generate v11n systems from an IMP file git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@172 07627401-56e2-0310-80f4-f8cd0041bdcd --- versification/canon.af.xml | 6 ++ versification/canon.bible.xml | 204 ++++++++++++++++++++++++++++++++----- versification/canon.lds.xml | 16 +++ versification/canon.naghammadi.xml | 12 ++- versification/canon.nta.xml | 20 +++- versification/canon.otp.xml | 40 ++++++-- versification/v11nsys.pl | 52 +++++++--- 7 files changed, 299 insertions(+), 51 deletions(-) diff --git a/versification/canon.af.xml b/versification/canon.af.xml index d0a7121..7feea23 100644 --- a/versification/canon.af.xml +++ b/versification/canon.af.xml @@ -13,11 +13,17 @@ 1Clem 1Cl I Clement + IClement + 1 Clement + 1Clement 2Clem 2Cl II Clement + IIClement + 2 Clement + 2Clement Did diff --git a/versification/canon.bible.xml b/versification/canon.bible.xml index e97ecf6..5a621e5 100644 --- a/versification/canon.bible.xml +++ b/versification/canon.bible.xml @@ -6,6 +6,7 @@ Gen Ge Genesis + G Exod @@ -22,23 +23,27 @@ Num Nu Numbers + N Deut Deu De Deuteronomy + D Josh Jos Joshua + J Judg Jdg Judges + Jdgs Ruth @@ -50,31 +55,57 @@ 1Sam 1Sa I Samuel + ISamuel + 1 Samuel + 1Samuel 2Sam 2Sa II Samuel + IISamuel + 2 Samuel + 2Samuel 1Kgs 1Ki I Kings + IKings + 1 Kings + 1Kings + I Kgs + IKgs + 1 Kgs + 1Kgs 2Kgs 2Ki II Kings + IIKings + 2 Kings + 2Kings + II Kgs + IIKgs + 2 Kgs + 2Kgs 1Chr 1Ch I Chronicles + IChronicles + 1 Chronicles + 1Chronicles 2Chr 2Ch II Chronicles + IIChronicles + 2 Chronicles + 2Chronicles Ezra @@ -91,6 +122,7 @@ Est Es Esther + Ester Job @@ -100,6 +132,9 @@ Ps Psa Psalms + P + Psm + Pss Prov @@ -112,7 +147,8 @@ Ecc Ec Ecclesiastes - Qohelot + Qohelet + Qoheleth Song @@ -120,6 +156,9 @@ So Song of Solomon Canticle of Canticles + Sng + Solomon + Song of Songs Isa @@ -138,6 +177,7 @@ Ezek Eze Ezekiel + Ezk Dan @@ -153,6 +193,7 @@ Joel Joe Joel + Jol Amos @@ -179,6 +220,7 @@ Nah Na Nahum + Nam Hab @@ -206,25 +248,32 @@ Matt Mat - Mt Matthew + Ma + Mt Mark Mar - Mk Mark + Mk + Mrk Luke Luk Lu Luke + L + Lk John Joh John + Jhn + Jn + Jo Acts @@ -241,11 +290,25 @@ 1Cor 1Co I Corinthians + ICorinthians + 1 Corinthians + 1Corinthians + I C + IC + 1 C + 1C 2Cor 2Co II Corinthians + IICorinthians + 2 Corinthians + 2Corinthians + II C + IIC + 2 C + 2C Gal @@ -255,36 +318,50 @@ Eph Ephesians + E Phil Phi - Php Philippians + Php Col Colossians + C 1Thess 1Th I Thessalonians + IThessalonians + 1 Thessalonians + 1Thessalonians 2Thess 2Th II Thessalonians + IIThessalonians + 2 Thessalonians + 2Thessalonians 1Tim 1Ti I Timothy + ITimothy + 1 Timothy + 1Timothy 2Tim 2Ti II Timothy + IITimothy + 2 Timothy + 2Timothy Titus @@ -293,12 +370,13 @@ Phlm - Phm Philemon + Phm Heb Hebrews + H Jas @@ -309,26 +387,61 @@ 1Pet 1Pe I Peter + IPeter + 1 Peter + 1Peter + I Ptr + IPtr + 1 Ptr + 1Ptr 2Pet 2Pe II Peter + IIPeter + 2 Peter + 2Peter + II Ptr + IIPtr + 2 Ptr + 2Ptr 1John 1Jo I John + IJohn + 1 John + 1John + I Jn + IJn + 1 Jn + 1Jn 2John 2Jo II John + IIJohn + 2 John + 2John + II Jn + IIJn + 2 Jn + 2Jn 3John 3Jo III John + IIIJohn + 3 John + 3John + III Jn + IIIJn + 3 Jn + 3Jn Jude @@ -339,11 +452,14 @@ Rev Re Revelation of John + Apocalypse of St. John + Apocalypse of John Tob Tobit + Tbt Jdt @@ -358,53 +474,84 @@ Sir Sirach Ecclesiasticus + Wisdom of Jesus Son of Sirach + Wisdom of Ben Sira Bar Baruch I Baruch + IBaruch + 1 Baruch + 1Baruch EpJer - Epj Epistle of Jeremiah + Epj 1Esd 1Es 3Es I Esdras + IEsdras + 1 Esdras + 1Esdras III Ezra + IIIEzra + 3 Ezra + 3Ezra Esdras A + EsdrasA 2Esd 2Es 4Es II Esdras + IIEsdras + 2 Esdras + 2Esdras IV Ezra + IVEzra + 4 Ezra + 4Ezra Esdras B + EsdrasB 1Macc 1Ma I Maccabees + IMaccabees + 1 Maccabees + 1Maccabees 2Macc 2Ma II Maccabees + IIMaccabees + 2 Maccabees + 2Maccabees 3Macc 3Ma III Maccabees + IIIMaccabees + 3 Maccabees + 3Maccabees 4Macc 4Ma IV Maccabees + IVMaccabees + 4 Maccabees + 4Maccabees Odes @@ -421,28 +568,32 @@ Psx 2Ps Additional Psalm + Psalm 151 EsthGr - Esg Esther (Greek) + Esg DanGr - Dng Daa Daniel (Greek) + Dng - EpLao - Lao + Lao Laodiceans + EpLao 1En I Enoch + IEnoch + 1 Enoch + 1Enoch Ethiopic Apocalypse of Enoch @@ -453,13 +604,15 @@ AddEsth Additions to Esther + Esther (Additions) PrAzar - Aza - Pra Prayer of Azariah Song of the Three Children + Azariah + Aza + Pra Sus @@ -471,59 +624,62 @@ PrMan - Prm - Man Prayer of Manasses + Prayer of Manasseh + Prm + Manasses + Manasseh + Man SirP - Sip Sirach (Prologue) + Sip JoshA - Jsa Joshua (Codex Alexandrinus) + Jsa JoshB - Jsb Joshua (Codex Vaticanus) + Jsb JudgA - Jda Joshua (Codex Alexandrinus) + Jda JudgB - Jdb Joshua (Codex Vaticanus) + Jdb TobBA - Tba Tobit (Codices Vaticanus Alexandrinusque) + Tba TobS - Tbs Tobit (Codex Sinaiticus) + Tbs DanTheo - Dat Daniel (Theodotion) + Dat SusTheo - Sut Susanna (Theodotion) + Sut BelTheo - Bet Bel and the Dragon (Theodotion) + Bet diff --git a/versification/canon.lds.xml b/versification/canon.lds.xml index 2d04802..3846797 100644 --- a/versification/canon.lds.xml +++ b/versification/canon.lds.xml @@ -8,10 +8,16 @@ 1Ne I Nephi + INephi + 1 Nephi + 1Nephi 2Ne II Nephi + IINephi + 2 Nephi + 2Nephi Jacob @@ -48,10 +54,16 @@ 3Ne III Nephi + IIINephi + 3 Nephi + 3Nephi 4Ne IV Nephi + IVNephi + 4 Nephi + 4Nephi Morm @@ -78,10 +90,12 @@ JSM + JS-M Joseph Smith-Matthew JSH + JS-H Joseph Smith-History @@ -93,7 +107,9 @@ DC + D&C Doctrine and Covenants + Doctrine & Covenants OD diff --git a/versification/canon.naghammadi.xml b/versification/canon.naghammadi.xml index 2b52440..19d628d 100644 --- a/versification/canon.naghammadi.xml +++ b/versification/canon.naghammadi.xml @@ -28,10 +28,16 @@ 1ApJas I Apocalypse of James + IApocalypse of James + 1 Apocalypse of James + 1Apocalypse of James 2ApJas II Apocalypse of James + IIApocalypse of James + 2 Apocalypse of James + 2Apocalypse of James ApPaul @@ -54,7 +60,8 @@ Dialogue of the Savior - Disc8-9 + Disc89 + Disc8-9 Discourse on the Eighth and Ninth @@ -202,8 +209,7 @@ PlatoRep - "Plato - Republic 588A-589B" + Plato Republic 588A-589B ScribalNote diff --git a/versification/canon.nta.xml b/versification/canon.nta.xml index 1ff8617..35fc952 100644 --- a/versification/canon.nta.xml +++ b/versification/canon.nta.xml @@ -19,15 +19,22 @@ InfGos 1In - Inf I Infancy Gospel + IInfancy Gospel + 1 Infancy Gospel + 1Infancy Gospel + Inf + Infancy InfGosThom 2In - IGT II Infancy Gospel + IIInfancy Gospel + 2 Infancy Gospel + 2Infancy Gospel Infancy Gospel of Thomas + IGT Abgar @@ -96,6 +103,9 @@ 3Cor III Corinthians + IIICorinthians + 3 Corinthians + 3Corinthians CorCorr @@ -321,10 +331,16 @@ 5Ezra V Ezra + VEzra + 5 Ezra + 5Ezra 6Ezra VI Ezra + VIEzra + 6 Ezra + 6Ezra ChrSib diff --git a/versification/canon.otp.xml b/versification/canon.otp.xml index 7cdbd63..2836156 100644 --- a/versification/canon.otp.xml +++ b/versification/canon.otp.xml @@ -2,7 +2,6 @@ - @@ -54,18 +53,27 @@ 2Bar 2Ba II Baruch + IIBaruch + 2 Baruch + 2Baruch Syriac Apocalypse of Baruch 3Bar 3Ba III Baruch + IIIBaruch + 3 Baruch + 3Baruch Greek Apocalypse of Baruch 4Bar 4Ba IV Baruch + IVBaruch + 4 Baruch + 4Baruch Paraleipomena Jeremiou @@ -98,13 +106,18 @@ 2En - 2En II Enoch + IIEnoch + 2 Enoch + 2Enoch Slavonic Apocalypse of Enoch 3En III Enoch + IIIEnoch + 3 Enoch + 3Enoch Hebrew Apocalypse of Enoch @@ -112,7 +125,8 @@ Eupolemus - Ps-Eup + PsEup + Ps-Eup Pseudo-Eupolemus @@ -148,7 +162,8 @@ Hecataeus Abdera - Ps-Hec + PsHec + Ps-Hec Pseudo-Hecataeus @@ -223,6 +238,8 @@ 5Mac 5Ma V Maccabees + 5 Maccabees + 5Maccabees SyrMen @@ -249,7 +266,8 @@ Book of Noah - Ps-Orph + PsOrph + Ps-Orph Orphica Pseudo-Orpheus @@ -258,11 +276,13 @@ Philo the Epic Poet - Ps-Philo + PsPhilo + Ps-Philo Pseudo-Philo - Ps-Phoc + PsPhoc + Ps-Phoc Pseudo-Phocyclides @@ -426,11 +446,17 @@ 1AdamEve + I Adam and Eve + IAdam and Eve 1 Adam and Eve + 1Adam and Eve 2AdamEve II Adam and Eve + IIAdam and Eve + 2 Adam and Eve + 2Adam and Eve diff --git a/versification/v11nsys.pl b/versification/v11nsys.pl index 6b40b84..fe0223d 100644 --- a/versification/v11nsys.pl +++ b/versification/v11nsys.pl @@ -22,11 +22,13 @@ sub buildBooks { if ($osis{lc($lastBook)} eq "Matt") { $otnt = 1; } + + $osisBook = $osis{lc($lastBook)}; if ($otnt == 0) { - $otbooks .= "\t{\"$idmap{$osis{lc($lastBook)}}\", \"$osis{lc($lastBook)}\", \"$osis{lc($lastBook)}\", $cCount},\n"; + $otbooks .= "\t{\"$idmap{$osisBook}\", \"$osisBook\", \"$osisBook\", $cCount},\n"; } else { - $ntbooks .= "\t{\"$idmap{$osis{lc($lastBook)}}\", \"$osis{lc($lastBook)}\", \"$osis{lc($lastBook)}\", $cCount},\n"; + $ntbooks .= "\t{\"$idmap{$osisBook}\", \"$osisBook\", \"$osisBook\", $cCount},\n"; } } @@ -51,49 +53,67 @@ foreach $mapfile (@canons) { $line = $_; $line =~ s///g; + $line =~ s/\&/\&/g; if ($line =~ /(.+?)<\/id>/) { $id = $1; $osis{lc($id)} = $id; } elsif ($line =~ /(.+?)<\/abbr>/) { - $osis{lc($1)} = $id; + $name = $1; + if ($osis{lc($name)} eq "") { + $osis{lc($name)} = $id; + } + else { + print "ERROR: Duplicate mapping from $id found in $mapfile ().\n"; + } } elsif ($line =~ /(.+?)<\/name>/) { $name = $1; - + if ($osis{lc($name)} eq "") { + $osis{lc($name)} = $id; + } + else { + print "ERROR: Duplicate mapping from $id found in $mapfile ().\n"; + } + if ($idmap{$id} eq "") { $idmap{$id} = $name; } else { # Duplicates most likely indicate alternate names, so ignore them. -# print "ERROR: Duplicate mapping from $id found in $mapfile.\n" +# print "ERROR: Duplicate mapping from $id found in $mapfile.\n"; } } } close (MAP); } - -$bwMode = false; +die(); if (@ARGV[0] ne "") { $n = 0; + $mode = "xml"; while (@ARGV[$n] ne "") { - if ($n == 0 && @ARGV[0] eq "--nosis") { - $bwMode = true; + if ($n == 0 && @ARGV[0] eq "--vpl") { + $mode = "vpl"; + } + elsif ($n == 0 && @ARGV[0] eq "--imp") { + $mode = "imp"; + } + elsif ($n == 0 && @ARGV[0] eq "--xml") { + $mode = "xml"; } else { push @srcfiles, @ARGV[$n]; } $n++; } - $vplStyle = true; } else { opendir (DIR, "."); @srcfiles = grep /Bible\.[^\.]+\.xml$/, readdir DIR; closedir(DIR); - $vplStyle = false; + $mode = "xml"; } foreach $infile (@srcfiles) { @@ -127,7 +147,7 @@ foreach $infile (@srcfiles) { $vm = "/******************************************************************************\n * Maximum verses per chapter\n */\n\nint vm$v11n\[\] = {"; $otbooks = "/******************************************************************************\n * [on]tbooks$v11n - initialize static instance for all canonical text names\n * and chapmax\n */\nstruct sbook otbooks$v11n\[\] = {\n"; $ntbooks = "struct sbook ntbooks$v11n\[\] = {\n"; - $booksCloser = "\t{\"\", \"\", \"\", 0}\n};\n"; + $booksCloser = "\t{\"\", \"\", \"\", 0}\n};\n\n"; $otnt = 0; # 0 = ot, 1 = nt @@ -139,9 +159,11 @@ foreach $infile (@srcfiles) { if ($line =~ //) { $osisID = $1; } - elsif ($vplStyle == true && $line =~ /^([^ ]+ [^ :]+:[^ :]+)/) { - $osisID = $1; - $osisID =~ s/[ :]/\./g; + elsif ($mode eq "vpl" && $line =~ /^(.+?) ([0-9A-Za-z]+):([0-9A-Za-z]+)/) { + $osisID = "$1.$2.$3"; + } + elsif ($mode eq "imp" && $line =~ /^\$\$\$(.+?) ([0-9A-Za-z]+):([0-9A-Za-z]+)/) { + $osisID = "$1.$2.$3"; } if ($osisID ne "") { -- cgit