[sword-svn] r309 - trunk/modules/crossreferences
refdoc at crosswire.org
refdoc at crosswire.org
Wed Oct 6 16:01:13 MST 2010
Author: refdoc
Date: 2010-10-06 16:01:13 -0700 (Wed, 06 Oct 2010)
New Revision: 309
Modified:
trunk/modules/crossreferences/xreffix.pl
Log:
produces now standard xrefs in OSIS
Modified: trunk/modules/crossreferences/xreffix.pl
===================================================================
--- trunk/modules/crossreferences/xreffix.pl 2010-10-04 03:11:17 UTC (rev 308)
+++ trunk/modules/crossreferences/xreffix.pl 2010-10-06 23:01:13 UTC (rev 309)
@@ -38,9 +38,9 @@
#########################################################################
use Sword;
+use feature "state";
-
$version = "1.1";
$osisVersion = "2.1.1";
@@ -50,7 +50,7 @@
$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 @@
$c_book = "Gen";
$c_chapter="1";
+$c_verse="1";
foreach (@data) {
@@ -99,10 +100,22 @@
$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;
+ }
+
More information about the sword-cvs
mailing list