def yield_verses(mod): from swlib.pysw import VK, TOP vk = VK() vk.Headings(1) vk.setPosition(TOP) #vk.setText("Matthew 1:1") vk.Persist(1) vk.thisown = False mod.setKey(vk) books = ("Genesis", "Matthew")#"Exodus") while not vk.Error(): #while vk.Testament() in '\x00\x01': #while vk.Testament() == '\x00' or vk.Book() == '\x00' or \ # vk.getBookName() in books: yield vk.increment(1)
def yield_verses(mod): from swlib.pysw import VK, TOP vk = VK() vk.Headings(1) vk.setPosition(TOP) #vk.setText("Matthew 1:1") vk.Persist(1) vk.thisown = False mod.setKey(vk) books = ("Genesis", "Matthew") #"Exodus") while not vk.Error(): #while vk.Testament() in '\x00\x01': #while vk.Testament() == '\x00' or vk.Book() == '\x00' or \ # vk.getBookName() in books: yield vk.increment(1)
def cut_down_index(self, bottom, top): ### not fully implemented for non-bibles vk1 = VK((self.bookname, self.bookname)) vk = VK((bottom, top)) vk_dn = vk.LowerBound() vk_up = vk.UpperBound() # the item we are currently looking for start_ref = None ret = [] items = [] self.old_text = self.text self.old_index = self.index for match in re.finditer("(?m)^.*$", self.text): if vk_dn <= vk1 <= vk_up: items.append(match.group()) vk1.increment(1) self.text = '\n'.join(items) self.create_index_against_text(vk)