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

chrislit at crosswire.org chrislit at crosswire.org
Sat Feb 14 00:58:24 MST 2009


Author: chrislit
Date: 2009-02-14 00:58:23 -0700 (Sat, 14 Feb 2009)
New Revision: 152

Modified:
   trunk/modules/perlconverters/usfm2osis.pl
Log:
added/corrected support for a few more tags

Modified: trunk/modules/perlconverters/usfm2osis.pl
===================================================================
--- trunk/modules/perlconverters/usfm2osis.pl	2009-02-09 01:54:38 UTC (rev 151)
+++ trunk/modules/perlconverters/usfm2osis.pl	2009-02-14 07:58:23 UTC (rev 152)
@@ -474,8 +474,8 @@
 	    $line =~ s/\\v\b\s*(\d[^\\ ]*)? *//;
 	}
 
-	### Paragraphs--Markers Supported: \p, \b, \m
-	#### Markers Not Yet Supported: \m, \pmo, \pm, \pmc, \pmr, \pi#, \mi, \nb, \cls, \li#, \pc, \pr, \ph#, \b
+	### Paragraphs--Markers Supported: \p, \b, \m, \nb
+	#### Markers Not Yet Supported: \m, \pmo, \pm, \pmc, \pmr, \pi#, \mi, \cls, \li#, \pc, \pr, \ph#, \b
 
 	# Hack to solve an issue in a module that used <R> for linebreaks in the usfm files--may be commented out (not USFM 2.1)
 	$line =~ s/\\lb\*/<lb \/>/g; 
@@ -488,10 +488,20 @@
 	    $line =~ s/\\p\b\s*//;
 	}
 
+	# \pc paragraph centered (From Chapters and Verses)
+	if ($line =~ /^\\pc\b\s*/) {
+	    push (@outdata, closeTag("<\/p>"));
+	    push (@outdata, "<p type=\"x-center\">\n");
+	    openTag("<\/p>");
+	    $line =~ s/\\pc\b\s*//;
+	}
+
 	# \b
 	$line =~ s/\\b\b//; 
 	# \m
 	$line =~ s/\\m\b//; 
+	# \nb
+	$line =~ s/\\nb\b//; 
 
 	### Poetry--Markers Supported: \q#, \qs...\qs*, \qc, \qm#
 	#### Markers Not Yet Supported: \qr, \qa, \qac...\qac*, \b
@@ -610,8 +620,8 @@
 	    return $ref;
 	}
 
-	### Footnotes--Markers Supported: \fk, \fq, \f...\f*, \fv
-	####Markers Not Yet Supported: \fe...\fe*, \fr, \fqa, \fl, \fp, \ft, \fdc...\fdc*, \fm...\fm* 
+	### Footnotes--Markers Supported: \fk, \fq, \f...\f*, \fv, \fqa
+	####Markers Not Yet Supported: \fe...\fe*, \fr, \fl, \fp, \ft, \fdc...\fdc*, \fm...\fm* 
 	
 	sub footnoteHandler {
 	    $note = @_[0];
@@ -628,20 +638,28 @@
 	    $note =~ s/\\fq\s(.+?)(?=\\f)/<catchWord>$1<\/catchWord>/g;
 	    $note =~ s/\\fq\*//g;
 
+	    # \fqa Alternate translations in Footnotes
+	    $note =~ s/\\fqa\s(.+?)\\fqa\*/<rdg type=\"alternate\">$1<\/rdg>/g;
+	    $note =~ s/\\fqa\s(.+?)(?=\\f)/<rdg type=\"alternate\">$1<\/rdg>/g;
+	    $note =~ s/\\fqa\*//g;
+
 	    # \fv Footnote verse number
-	    $note =~ s/\\fv\s*(\d+)\b\s*(?=\\f)/<reference osisID=\"$book.$vers.$1\">$1<\/reference>/g;
-	    
+	    $note =~ s/\\fv\s(.+?)\\fv\*/<reference osisID=\"$book.$chap.$1\">$1<\/reference>/g;
+	    $note =~ s/\\fv\s*(\d+)\b\s*(?=\\f)/<reference osisID=\"$book.$chap.$1\">$1<\/reference>/g;	
+	    $note =~ s/\\fv\*//g;
+    
 	    # \fr Footnote origin reference (the verse where the fn appears)
-	    while ($note =~ /\\fr\s*(.+?)\s*(?=\\x)/) {
+	    while ($note =~ /\\fr\s*(.+?)\s*(?=\\f)/) {
 		$sourceVal = parseRef($1);
 		$nFN++; 		
-#		$note =~ s/\\fr\s*(.+?)\s*(?=\\x)//;
+#		$note =~ s/\\fr\s*(.+?)\s*(?=\\f)//;
 		$note =~ s/\\fr\s*//;
 		$note =~ s/<note>/<note n="$nFN">/;
 	    }
 	    
 	    # \ft Footnote text
 	    $note =~ s/\\ft\s//g;
+	    $note =~ s/\\ft\*//g;
 
 	    # \f* Footnote closer
 	    $note =~ s/\\f\*//;




More information about the sword-cvs mailing list