diff options
author | Chris Little <chrislit@crosswire.org> | 2013-07-23 15:52:52 +0000 |
---|---|---|
committer | Chris Little <chrislit@crosswire.org> | 2013-07-23 15:52:52 +0000 |
commit | 98f6df08f88456f054f008f14f6f52599c9cb108 (patch) | |
tree | 1845ffe3bd2e2b0956cc98ac0895ed801c9bfdf9 /versification/makeabbrevs.pl | |
parent | 173cabf50ae76bd25aa283ae3c7869ed14832706 (diff) | |
download | sword-tools-98f6df08f88456f054f008f14f6f52599c9cb108.tar.gz |
set various svn properties
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@438 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'versification/makeabbrevs.pl')
-rwxr-xr-x[-rw-r--r--] | versification/makeabbrevs.pl | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/versification/makeabbrevs.pl b/versification/makeabbrevs.pl index 90f5d4a..f04d276 100644..100755 --- a/versification/makeabbrevs.pl +++ b/versification/makeabbrevs.pl @@ -1,81 +1,81 @@ -#!/usr/bin/perl
-
-# $finalBook = "Rev"; # quit reading canon files after we reach this book (an OSIS id)-- this is a temporary measure for 1.6.0, since we don't support any apocrypha yet anyway
-
-# @canons will contain this list of files, these are in a basic XML format.
-# Each file lists osisIDs along with the English names associated with the
-# osisID. These aren't exhaustive, and may or may not overlap (but hopefully
-# don't). We are only using these to load mappings from osisIDs.
-@canons = (
- "canon.bible.xml", # the Bible, broadly defined
-# "canon.af.xml", # Apostolic Fathers
-# "canon.otp.xml", # OT pseudepigrapha
-# "canon.nta.xml", # NT apocrypha
-# "canon.lds.xml", # Mormon books
-# "canon.naghammadi.xml", # Nag Hammadi Library
-# "canon.qumran.xml", # Qumran mss
-# "canon.classical.xml", # intended for classical works, currently just Josephus
-);
-
-@abbrevsQueue = ();
-
-if ($finalBook eq "") {
- $finalBook = "\#PARSE ALL BOOKS\#";
-}
-
-foreach $mapfile (@canons) {
- open MAP, "$mapfile";
- while (<MAP>) {
- $line = $_;
-
- $line =~ s/<!\-\-.+?\-\->//g;
- $line =~ s/\&/\&/g;
-
- if ($line =~ /<id>(.+?)<\/id>/) {
- if ($id eq $finalBook) {
- last;
- }
- $id = $1;
- $osis{lc($id)} = $id;
- push @abbrevsQueue, uc($id);
- }
- elsif ($line =~ /<name>(.+?)<\/name>/) {
- $name = $1;
- if ($osis{lc($name)} eq "") {
- $osis{lc($name)} = $id;
- push @abbrevsQueue, uc($name);
- }
- else {
- if ($warn) {
- 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.
- if ($warn) {
- print "ERROR: Duplicate mapping from $id found in $mapfile.\n";
- }
- }
- }
- }
- close (MAP);
-}
-
-$abbrevs = "/******************************************************************************\n * canon_abbrevs.h - Canonical text information to be included by VerseKey.cpp\n *\n * Copyright 1998-2009 CrossWire Bible Society (http://www.crosswire.org)\n * CrossWire Bible Society\n * P. O. Box 2528\n * Tempe, AZ 85280-2528\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License as published by the\n * Free Software Foundation version 2.\n *\n * This program is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * General Public License for more details.\n *\n */\n\n#ifndef CANON_ABBREVS_H\n#define CANON_ABBREVS_H\n\nSWORD_NAMESPACE_START\n\n\n/******************************************************************************\n * Abbreviations - MUST be in alphabetical order & by PRIORITY\n * RULE: first match of entire key\n * (e.g. key: \"1CH\"; match: \"1CHRONICLES\")\n */\n\nconst struct abbrev builtin_abbrevs\[\] = {\n";
-
-@abbrevsQueue = sort @abbrevsQueue;
-foreach $a (@abbrevsQueue) {
- if ($a =~ /^.+\d/) {
- $abbrevs .= "//";
- }
- $abbrevs .= " {\"" . $a . "\", \"" . $osis{lc($a)} . "\"},\t\t// " . $idmap{$osis{lc($a)}} . "\n";
-}
-$abbrevs .= " {\"\", \"\"}\n};\n\n\nSWORD_NAMESPACE_END\n\n\n#endif\n";
-
-open OUTF, ">canon_abbrevs.h";
-print OUTF $abbrevs;
-close OUTF;
+#!/usr/bin/perl + +# $finalBook = "Rev"; # quit reading canon files after we reach this book (an OSIS id)-- this is a temporary measure for 1.6.0, since we don't support any apocrypha yet anyway + +# @canons will contain this list of files, these are in a basic XML format. +# Each file lists osisIDs along with the English names associated with the +# osisID. These aren't exhaustive, and may or may not overlap (but hopefully +# don't). We are only using these to load mappings from osisIDs. +@canons = ( + "canon.bible.xml", # the Bible, broadly defined +# "canon.af.xml", # Apostolic Fathers +# "canon.otp.xml", # OT pseudepigrapha +# "canon.nta.xml", # NT apocrypha +# "canon.lds.xml", # Mormon books +# "canon.naghammadi.xml", # Nag Hammadi Library +# "canon.qumran.xml", # Qumran mss +# "canon.classical.xml", # intended for classical works, currently just Josephus +); + +@abbrevsQueue = (); + +if ($finalBook eq "") { + $finalBook = "\#PARSE ALL BOOKS\#"; +} + +foreach $mapfile (@canons) { + open MAP, "$mapfile"; + while (<MAP>) { + $line = $_; + + $line =~ s/<!\-\-.+?\-\->//g; + $line =~ s/\&/\&/g; + + if ($line =~ /<id>(.+?)<\/id>/) { + if ($id eq $finalBook) { + last; + } + $id = $1; + $osis{lc($id)} = $id; + push @abbrevsQueue, uc($id); + } + elsif ($line =~ /<name>(.+?)<\/name>/) { + $name = $1; + if ($osis{lc($name)} eq "") { + $osis{lc($name)} = $id; + push @abbrevsQueue, uc($name); + } + else { + if ($warn) { + 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. + if ($warn) { + print "ERROR: Duplicate mapping from $id found in $mapfile.\n"; + } + } + } + } + close (MAP); +} + +$abbrevs = "/******************************************************************************\n * canon_abbrevs.h - Canonical text information to be included by VerseKey.cpp\n *\n * Copyright 1998-2009 CrossWire Bible Society (http://www.crosswire.org)\n * CrossWire Bible Society\n * P. O. Box 2528\n * Tempe, AZ 85280-2528\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License as published by the\n * Free Software Foundation version 2.\n *\n * This program is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * General Public License for more details.\n *\n */\n\n#ifndef CANON_ABBREVS_H\n#define CANON_ABBREVS_H\n\nSWORD_NAMESPACE_START\n\n\n/******************************************************************************\n * Abbreviations - MUST be in alphabetical order & by PRIORITY\n * RULE: first match of entire key\n * (e.g. key: \"1CH\"; match: \"1CHRONICLES\")\n */\n\nconst struct abbrev builtin_abbrevs\[\] = {\n"; + +@abbrevsQueue = sort @abbrevsQueue; +foreach $a (@abbrevsQueue) { + if ($a =~ /^.+\d/) { + $abbrevs .= "//"; + } + $abbrevs .= " {\"" . $a . "\", \"" . $osis{lc($a)} . "\"},\t\t// " . $idmap{$osis{lc($a)}} . "\n"; +} +$abbrevs .= " {\"\", \"\"}\n};\n\n\nSWORD_NAMESPACE_END\n\n\n#endif\n"; + +open OUTF, ">canon_abbrevs.h"; +print OUTF $abbrevs; +close OUTF; |