def GetText(self, ref): print "Getting text for", ref template = VerseTemplate(header=self.template_panel.header.GetText(), body=self.template_panel.body.GetText(), footer=self.template_panel.footer.GetText()) #no footnotes biblemgr.temporary_state(biblemgr.plainstate) if display_options.options["colour_speakers"] == "woc_in_red": biblemgr.set_option("Words of Christ in Red", "On") #apply template biblemgr.bible.templatelist.append(template) biblemgr.parser_mode = COPY_VERSES_PARSER_MODE data = biblemgr.bible.GetReference(ref) if data is None: data = config.MODULE_MISSING_STRING() if self.formatted: # TODO: make it scan CSS and amalgamate rules? data = data.replace("<span class='WoC'>", "<span style='color: red'>") data = data.replace("<span class='divineName'>", "<span style='font-variant:small-caps'>") # Use the font that has been selected for the module. # XXX: We could still use language specific fonts for particular # sections of the text, but I'm not sure it's worth doing. # It would probably only apply to Hebrew and Greek (which we # treat specially) anyway. default, (font, size, in_gui) = fonts.get_module_font_params( biblemgr.bible.mod) data = u"<span style=\"font-family: %s; font-size: %spt;\">%s</span>" % ( font, size, data) else: data = string_util.br2nl(data) data = string_util.KillTags(data) data = string_util.amps_to_unicode(data) #restore biblemgr.restore_state() biblemgr.bible.templatelist.pop() biblemgr.parser_mode = NORMAL_PARSER_MODE return data
def convert_language(text, language_code): # remove all ӛ's which will stop our language recognition text = string_util.amps_to_unicode(text, replace_specials=False) # put greek and hebrew in their fonts for lang_code, letters, dont_use_for in ( # ancient greek (to 1453) ("grc", string_util.greek, ("el", "grc")), # Hebrew (generally) ("he", string_util.hebrew, ("he",)), ): # if we are, say, a greek book, don't take greek out specially if language_code in dont_use_for: continue text = string_util.insert_language_font(text, letters, lang_code) return text
def convert_language(text, language_code): # remove all ӛ's which will stop our language recognition text = string_util.amps_to_unicode(text, replace_specials=False) # put greek and hebrew in their fonts for lang_code, letters, dont_use_for in ( # ancient greek (to 1453) ("grc", string_util.greek, ("el", "grc")), # Hebrew (generally) ("he", string_util.hebrew, ("he", )), ): # if we are, say, a greek book, don't take greek out specially if language_code in dont_use_for: continue text = string_util.insert_language_font(text, letters, lang_code) return text
def GetText(self, ref): print "Getting text for", ref template = VerseTemplate(header=self.template_panel.header.GetText(), body=self.template_panel.body.GetText(), footer=self.template_panel.footer.GetText()) #no footnotes biblemgr.temporary_state(biblemgr.plainstate) if display_options.options["colour_speakers"] == "woc_in_red": biblemgr.set_option("Words of Christ in Red", "On") #apply template biblemgr.bible.templatelist.append(template) biblemgr.parser_mode = COPY_VERSES_PARSER_MODE data = biblemgr.bible.GetReference(ref) if data is None: data = config.MODULE_MISSING_STRING() if self.formatted: # TODO: make it scan CSS and amalgamate rules? data = data.replace("<span class='WoC'>", "<span style='color: red'>") data = data.replace("<span class='divineName'>", "<span style='font-variant:small-caps'>") # Use the font that has been selected for the module. # XXX: We could still use language specific fonts for particular # sections of the text, but I'm not sure it's worth doing. # It would probably only apply to Hebrew and Greek (which we # treat specially) anyway. default, (font, size, in_gui) = fonts.get_module_font_params(biblemgr.bible.mod) data = u"<span style=\"font-family: %s; font-size: %spt;\">%s</span>" % (font, size, data) else: data = string_util.br2nl(data) data = string_util.KillTags(data) data = string_util.amps_to_unicode(data) #restore biblemgr.restore_state() biblemgr.bible.templatelist.pop() biblemgr.parser_mode = NORMAL_PARSER_MODE return data