def __sub__(self, r): if not self.overlaps(r): return [self] if r == self: return [] chunks = [] if self <= r and (self.chap1 < r.chap1 or self.verse1 < r.verse1): if r.verse1 == 1: b, c1, v1, cN, vN = scriptures.normalize_reference( self.book, self.chap1, self.verse1, r.chap1 - 1) else: b, c1, v1, cN, vN = scriptures.normalize_reference( self.book, self.chap1, self.verse1, r.chap1, r.verse1 - 1) chunks.append(Reading(b, c1, v1, cN, vN)) if self >= r and (self.chapN > r.chapN or self.verseN > r.verseN): print('hello', self, r) try: b, c1, v1, cN, vN = scriptures.normalize_reference( self.book, r.chapN, r.verseN + 1, self.chapN, self.verseN) except: b, c1, v1, cN, vN = scriptures.normalize_reference( self.book, r.chapN + 1, end_chapter=self.chapN, end_verse=self.verseN) chunks.append(Reading(b, c1, v1, cN, vN)) for rr in chunks: if self.kids: rr.kids = True rr.topics = copy.copy(self.topics) rr.category = rr.category return chunks
def f(txt): """ accept a string containing a scripture reference, normalize it, and then return the reformatted string """ return reference_to_string(*normalize_reference( *scripture_re.match(txt).groups()))
def f(txt): """ accept a string containing a scripture reference, normalize it, and then return the reformatted string """ return reference_to_string( *normalize_reference(*scripture_re.match(txt).groups()))
def f(txt): """ accept a string containing a scripture reference, normalize it, and then return the reformatted string """ #print("parsing {}".format(txt)) res = reference_to_string( *normalize_reference(*scripture_re.match(txt).groups())) #print("...yielded {}".format(res)) return res
def normalize(txt): return normalize_reference(*scripture_re.match(txt).groups())