def end_scripRef(self, xmltag): if not filterutils.filter_settings["expand_thml_refs"]: self.success = SW.INHERITED return refList = self.scripRef_passage if self.u.module.Type() == "Biblical Texts": if refList: dprint(MESSAGE, "FOUND ThML reflist in Bible", refList) self.success = SW.INHERITED return else: refs = self.u.lastTextNode.c_str().split(";") self.buf += filterutils.ellipsize(refs, self.u.key.getText()) self.u.suspendTextPassThru = False return # if we have a ref list, then we need to display the text and just # pop up usual thing if refList: self.buf += ( "<a href=\"newbible://content/passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">" ) % (SW.URL.encode(refList).c_str(), "") self.buf += self.u.lastTextNode.c_str() self.buf += "</a>" else: # break it up into its constituent parts and display each as a # separate link refList = self.u.lastTextNode.c_str() items = [] last = GetVerseStr(self.u.key.getText()) for item in refList.split(";"): vref = item vref = GetBestRange(to_unicode(vref), context=last, use_bpbible_locale=True) items.append('<a href="bible:%s">%s</a>' % (vref, item)) last = vref self.buf += "; ".join(items) # let text resume to output again self.u.suspendTextPassThru = False
def end_scripRef(self, xmltag): if not filterutils.filter_settings["expand_thml_refs"]: self.success = SW.INHERITED return refList = self.scripRef_passage if self.u.module.Type() == "Biblical Texts": if refList: dprint(MESSAGE, "FOUND ThML reflist in Bible", refList) self.success = SW.INHERITED return else: refs = self.u.lastTextNode.c_str().split(";") self.buf += filterutils.ellipsize(refs, self.u.key.getText()) self.u.suspendTextPassThru = False return # if we have a ref list, then we need to display the text and just # pop up usual thing if refList: self.buf += ("<a href=\"newbible://content/passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">") % ( SW.URL.encode(refList).c_str(), "" ) self.buf += self.u.lastTextNode.c_str() self.buf += "</a>" else: # break it up into its constituent parts and display each as a # separate link refList = self.u.lastTextNode.c_str() items = [] last = GetVerseStr(self.u.key.getText()) for item in refList.split(";"): vref = item vref = GetBestRange(to_unicode(vref), context=last, use_bpbible_locale=True) items.append('<a href="bible:%s">%s</a>' %(vref, item)) last = vref self.buf += "; ".join(items) # let text resume to output again self.u.suspendTextPassThru = False
def start_note(self, xmltag): self.did_xref = False type = xmltag.getAttribute("type") footnoteNumber = xmltag.getAttribute("swordFootnote") if not type: print "Not type - module bug", xmltag.toString() type = "missing" if not type or not footnoteNumber: if type != "x-strongsMarkup": print "FAILED", xmltag.toString() self.success = SW.INHERITED return was_xref = type in ("crossReference", "x-cross-ref") footnote_type = "n" if was_xref: footnote_type = "x" expand_crossref = filterutils.filter_settings["footnote_ellipsis_level"] footnotes = SW.Buf("Footnote") refList = SW.Buf("refList") n = SW.Buf("n") number = SW.Buf(footnoteNumber) map = self.u.module.getEntryAttributesMap() footnote = map[footnotes][number] if n in footnote: footnote_char = footnote[n].c_str() else: if was_xref: footnote_char = "x" else: footnote_char = "n" refs_to_expand = None if expand_crossref: try: refs_to_expand = footnote[refList].c_str() except IndexError: dprint(WARNING, "Error getting Footnote '%s' refList" % footnoteNumber) if refs_to_expand: self.u.inXRefNote = True self.buf += filterutils.ellipsize( refs_to_expand.split(";"), self.u.key.getText(), int(filterutils.filter_settings["footnote_ellipsis_level"]) ) else: c = "footnote footnote_%s" % type self.buf += "<a class=\"%s\" href=\"newbible://content/passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\">%s</a>" % ( c, footnote_type, SW.URL.encode(footnoteNumber).c_str(), SW.URL.encode(self.u.version.c_str()).c_str(), SW.URL.encode(self.u.key.getText()).c_str(), footnote_char ) self.did_xref = True self.u.suspendLevel += 1 self.u.suspendTextPassThru = self.u.suspendLevel