[sword-svn] r383 - trunk/modules/python
chrislit at crosswire.org
chrislit at crosswire.org
Sun Aug 12 11:32:31 MST 2012
Author: chrislit
Date: 2012-08-12 11:32:31 -0700 (Sun, 12 Aug 2012)
New Revision: 383
Modified:
trunk/modules/python/usfm2osis.py
Log:
added fallback for handling descending verse ranges, e.g. \v 9-5 (treated as \v 9-9)
Modified: trunk/modules/python/usfm2osis.py
===================================================================
--- trunk/modules/python/usfm2osis.py 2012-08-12 10:28:26 UTC (rev 382)
+++ trunk/modules/python/usfm2osis.py 2012-08-12 18:32:31 UTC (rev 383)
@@ -999,11 +999,12 @@
def processOsisIDs(osis):
+ # TODO: add support for subverses, including in ranges/series, e.g. Matt.1.1!b-Matt.2.5,Matt.2.7!a
# expand verse ranges, series
def expandRange(vRange):
vRange = re.findall(r'\d+', vRange)
osisID = list()
- for n in range(int(vRange[0]), int(vRange[1])+1):
+ for n in range(int(vRange[0]), max(int(vRange[0]), int(vRange[1]))+1):
osisID.append('$BOOK$.$CHAP$.'+str(n))
return ' '.join(osisID)
osis = re.sub(r'\$BOOK\$\.\$CHAP\$\.(\d+-\d+)"', lambda m: expandRange(m.group(1))+'"', osis)
More information about the sword-cvs
mailing list