summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorPeter von Kaehne <refdoc@gmx.net>2010-08-24 08:24:22 +0000
committerPeter von Kaehne <refdoc@gmx.net>2010-08-24 08:24:22 +0000
commitcc17b87634e36b66d082e79e395a620ec26997bd (patch)
treebe9c57057203ee8cfcc60046a7728803784134e4 /modules
parent39a1d1b537a3ab8569d6eb448ab9e2a0c983572b (diff)
downloadsword-tools-cc17b87634e36b66d082e79e395a620ec26997bd.tar.gz
using now perl bindings successfully. Speed gone up from 1hr to <1 sec for average whole OSIS Bible on my laptop
Many thanks Greg! git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@301 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules')
-rw-r--r--modules/crossreferences/xreffix.pl35
1 files changed, 20 insertions, 15 deletions
diff --git a/modules/crossreferences/xreffix.pl b/modules/crossreferences/xreffix.pl
index 29248e8..d7ac2fc 100644
--- a/modules/crossreferences/xreffix.pl
+++ b/modules/crossreferences/xreffix.pl
@@ -37,20 +37,18 @@
## sword-support@crosswire.org
#########################################################################
-sub vs2osis {
+use Sword;
+
- my $return = `vs2osisref "$_[0]" "$_[1]" $_[2]`;
- $return =~ s/\n$//;
- $return;
-}
-$version = "1.0";
+$version = "1.1";
$osisVersion = "2.1.1";
$date = '$Date: 2010-08-04 05:46:26 +0000 (Tue, 04 Aug 2009) $';
$rev = '$Rev: 231 $';
-
+$mgr = new Sword::SWMgr();
+$module = $mgr->getModule('KJV');
if (scalar(@ARGV) < 2) {
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";
@@ -72,6 +70,9 @@ elsif ($ARGV[3] eq "-l") {
else {
$locale = "en";
}
+
+Sword::LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName($locale);
+
open (OUTF, ">", "$outputFilename") or die "Could not open file $outputFilename for writing.";
open (INF, "<", $ARGV[0]);
@@ -79,24 +80,28 @@ open (INF, "<", $ARGV[0]);
close (INF);
$c_book = "Gen";
-$c_chapter="1"
+$c_chapter="1";
foreach (@data) {
if (/xml:lang\=\"(.+?)\"/) {
- $locale=$1;
- print "This document is in the locale of ".$locale."\n";
- }
+ if ($locale ne $1) {
+ print "This document is in the locale of ".$1."\n";
+ Sword::LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName($1);
+ }
+
+ }
if (/<div\ type\=\"book\"\ osisID=\"(.+?)\">/) {
$c_book=$1;
print "\n"."Now working on ".$c_book."\n";
- }
+ }
if (/<chapter\ sID\=\".*?\.([0-9]+)\"/) {
$c_chapter=$1;
print ".";
- }
-
- s/<reference>(.*?)<\/reference>/&vs2osis($1,$c_book.$c_chapter,$locale)/eg;
+ }
+ my $scope= new Sword::VerseKey;
+ $scope->setText($c_book.$c_chapter);
+ s/<reference>(.*?)<\/reference>/Sword::VerseKey::convertToOSIS($1, $scope)/eg;
}
print (OUTF @data);
close OUTF;