summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorPeter von Kaehne <refdoc@gmx.net>2010-10-06 23:01:13 +0000
committerPeter von Kaehne <refdoc@gmx.net>2010-10-06 23:01:13 +0000
commit7ac406fababa685a98363486a01b81edb4ad483f (patch)
tree50776848d9b926a19f57d04347795a70f177c3ca /modules
parent86b3ab80c8d606090e5b80db37d064808f6f4055 (diff)
downloadsword-tools-7ac406fababa685a98363486a01b81edb4ad483f.tar.gz
produces now standard xrefs in OSIS
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@309 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules')
-rw-r--r--modules/crossreferences/xreffix.pl23
1 files changed, 18 insertions, 5 deletions
diff --git a/modules/crossreferences/xreffix.pl b/modules/crossreferences/xreffix.pl
index d7ac2fc..e65332b 100644
--- a/modules/crossreferences/xreffix.pl
+++ b/modules/crossreferences/xreffix.pl
@@ -38,7 +38,7 @@
#########################################################################
use Sword;
-
+use feature "state";
$version = "1.1";
@@ -50,7 +50,7 @@ $rev = '$Rev: 231 $';
$mgr = new Sword::SWMgr();
$module = $mgr->getModule('KJV');
-if (scalar(@ARGV) < 2) {
+if (scalar(@ARGV) < 1) {
print "xreffix.pl -- fixes crossreferences in OSIS files where usfm2osis.pl has failed. version $version\nRevision $rev ($date)\nSyntax: xreffix.pl <input filename> [-o <output-file>] [-l <xreflocale>].\n";
exit (-1);
}
@@ -81,6 +81,7 @@ close (INF);
$c_book = "Gen";
$c_chapter="1";
+$c_verse="1";
foreach (@data) {
@@ -99,10 +100,22 @@ foreach (@data) {
$c_chapter=$1;
print ".";
}
+ if (/<verse\ sID\=\".*?\.([0-9]+)\"/) {
+ $c_verse=$1;
+ }
my $scope= new Sword::VerseKey;
- $scope->setText($c_book.$c_chapter);
- s/<reference>(.*?)<\/reference>/Sword::VerseKey::convertToOSIS($1, $scope)/eg;
+ $scope->setText($c_book.$c_chapter.$c_verse);
+ s/<note\ type=\"crossReference\">(.*?)<\/note>/"<note n=\"".note_index()."\" type=\"crossReference\" osisRef=\"$c_book.$c_chapter.$c_verse\" osisID=\"$c_book.$c_chapter.$c_verse!crossReference.".note_index()."\">".Sword::VerseKey::convertToOSIS($1, $scope)."<\/note>"/eg;
}
print (OUTF @data);
close OUTF;
- \ No newline at end of file
+
+sub note_index {
+
+ my @note = qw(a a b b c c d d e e f f g g h h i i j j k k l l m m n n o o p p q q r r s s t t u u v v w w x x y y z z );
+ state $i=0;
+ $return = $note[$i % 52];
+ ++$i;
+ $return;
+ }
+