[sword-svn] r355 - trunk/modules/perlconverters

chrislit at crosswire.org chrislit at crosswire.org
Fri Mar 9 02:23:40 MST 2012


Author: chrislit
Date: 2012-03-09 02:23:40 -0700 (Fri, 09 Mar 2012)
New Revision: 355

Modified:
   trunk/modules/perlconverters/usfm2osis.pl
Log:
made \wj handling a little more robust (so that it now tolerates crossing linebreaks)

Modified: trunk/modules/perlconverters/usfm2osis.pl
===================================================================
--- trunk/modules/perlconverters/usfm2osis.pl	2012-03-09 09:04:37 UTC (rev 354)
+++ trunk/modules/perlconverters/usfm2osis.pl	2012-03-09 09:23:40 UTC (rev 355)
@@ -87,6 +87,8 @@
 
 $divOpen=false;
 
+$wj = 0; # number of \wj's we've encountered
+
 # Generates a list of available encodings.
 use Encode;
 @encodingList = Encode->encodings(":all");
@@ -940,7 +942,15 @@
 	$line =~ s/\\add\b\s*(.*?)\\add\*/<transChange type=\"added\">$1<\/transChange>/g;
 
 	# \wj...\wj*, Words of Jesus
-	$line =~ s/\\wj\b\s*(.*?)\\wj\*/<q who="Jesus" marker="">$1<\/q>/g;
+	sub wjCount {
+	    if (@_[0] eq "") {
+		$wj++;
+		return "sID=\"q.$wj\" ";
+	    }
+	    return "eID=\"q.$wj\" ";
+	}
+	#$line =~ s/\\wj\b\s*(.*?)\\wj\*/<q who="Jesus" marker="">$1<\/q>/g;
+	$line =~ s/\\wj\b(\*?)\s*/"<q " . wjCount($1) . "who=\"Jesus\" marker=\"\"\/>"/eg;
 
 	# \pb, page break
 	$line =~ s/\\pb\b/<milestone type=\"pb\"\/>/g;




More information about the sword-cvs mailing list