def get_text(self): try: template = SmartVerseTemplate( header="<a href='nbible:$internal_range'><b>$range</b></a><br>", body=(config.body % ''), ) #no footnotes if tooltip_settings["plain_xrefs"]: biblemgr.temporary_state(biblemgr.plainstate) #apply template biblemgr.bible.templatelist.append(template) import displayframe text = "<hr>".join( displayframe.process_html_for_module(biblemgr.bible.mod, item) for item in biblemgr.bible.GetReferences(self.references) ) return text finally: if tooltip_settings["plain_xrefs"]: biblemgr.restore_state() biblemgr.bible.templatelist.pop()
def get_compare_text(self, ref): text = "" mod = self.book.mod try: self.book.templatelist.append(config.verse_compare_template) for item in self.book.GetModules(): if item.Name() in \ verse_comparison_settings["comparison_modules"]: self.book.mod = item # We exclude tags since otherwise the same tags appear in # every version, which isn't very sensible. module_text = process_html_for_module( item, self.book.GetReference(ref, display_tags=False)) text += u'<span class="parallel_verse" module="%s">%s</span>' % ( item.Name(), module_text) finally: self.book.mod = mod self.book.templatelist.pop() return text
def get_compare_text(self, ref): text = "" mod = self.book.mod try: self.book.templatelist.append(config.verse_compare_template) for item in self.book.GetModules(): if item.Name() in \ verse_comparison_settings["comparison_modules"]: self.book.mod = item # We exclude tags since otherwise the same tags appear in # every version, which isn't very sensible. module_text = process_html_for_module(item, self.book.GetReference(ref, display_tags=False) ) text += u'<span class="parallel_verse" module="%s">%s</span>' % (item.Name(), module_text) finally: self.book.mod = mod self.book.templatelist.pop() return text
def get_text(self): try: template = SmartVerseTemplate( header="<a href='nbible:$internal_range'><b>$range</b></a><br>", body=(config.body % ''), ) #no footnotes if tooltip_settings["plain_xrefs"]: biblemgr.temporary_state(biblemgr.plainstate) #apply template biblemgr.bible.templatelist.append(template) import displayframe text = "<hr>".join( displayframe.process_html_for_module(biblemgr.bible.mod, item) for item in biblemgr.bible.GetReferences(self.references)) return text finally: if tooltip_settings["plain_xrefs"]: biblemgr.restore_state() biblemgr.bible.templatelist.pop()
def get_parallel_text(self, ref): vk = SW.VerseKey() verselist = vk.ParseVerseList(to_str(ref), "", True) items = [] text = ["<table class='parallel_view'>", "<tr>"] for item in self.book.GetModules(): name = item.Name() if name in verse_comparison_settings["comparison_modules"]: items.append((item, list( self.book.GetReference_yield( verselist, module=item, max_verses=176, skip_linked_verses=False)))) text.append(u"<th>%s</th>" % process_html_for_module( item, u"<b><a href='%s:%s'>" "%s</a></b>" % (BIBLE_VERSION_PROTOCOL, name, name))) text.append("</tr>") # if we have no bibles to compare, return the empty string if not items: return "" rows = [] was_clipped = False try: self.book.templatelist.append(config.parallel_template) while True: text.append("<tr>") for module, refs in items: if not refs: text.append("</tr>") break body_dict, headings = refs.pop(0) if not body_dict: was_clipped = True # remove opening row text.pop() break text_direction = get_module_css_text_direction(module) text.append( u'<td class="parallel_verse" module="%s" dir="%s">' % (module.Name(), text_direction)) t = "" for heading_dict in headings: t += biblemgr.bible.templatelist[-1].\ headings.safe_substitute(heading_dict) t += biblemgr.bible.templatelist[-1].\ body.safe_substitute(body_dict) t = process_html_for_module(module, t) text.append(t) text.append("</td>") else: text.append("</tr>") continue break finally: self.book.templatelist.pop() text.append("</table>") if was_clipped: text.append(config.MAX_VERSES_EXCEEDED() % 177) return ''.join(text)
def get_parallel_text(self, ref): vk = SW.VerseKey() verselist = vk.ParseVerseList(to_str(ref), "", True) items = [] text = ["<table class='parallel_view'>", "<tr>"] for item in self.book.GetModules(): name = item.Name() if name in verse_comparison_settings["comparison_modules"]: items.append(( item, list(self.book.GetReference_yield( verselist, module=item, max_verses=176, skip_linked_verses=False )) )) text.append(u"<th>%s</th>" % process_html_for_module(item, u"<b><a href='%s:%s'>" "%s</a></b>" % (BIBLE_VERSION_PROTOCOL, name, name)) ) text.append("</tr>") # if we have no bibles to compare, return the empty string if not items: return "" rows = [] was_clipped = False try: self.book.templatelist.append(config.parallel_template) while True: text.append("<tr>") for module, refs in items: if not refs: text.append("</tr>") break body_dict, headings = refs.pop(0) if not body_dict: was_clipped = True # remove opening row text.pop() break text_direction = get_module_css_text_direction(module) text.append(u'<td class="parallel_verse" module="%s" dir="%s">' % (module.Name(), text_direction)) t = "" for heading_dict in headings: t += biblemgr.bible.templatelist[-1].\ headings.safe_substitute(heading_dict) t += biblemgr.bible.templatelist[-1].\ body.safe_substitute(body_dict) t = process_html_for_module(module, t) text.append(t) text.append("</td>") else: text.append("</tr>") continue break finally: self.book.templatelist.pop() text.append("</table>") if was_clipped: text.append(config.MAX_VERSES_EXCEEDED() % 177) return ''.join(text)