def fmt_glosses(self, search_conds=None): '''Return list of formatted strings, one per gloss.''' if search_conds and search_conds.field == 'gloss': matchreg = search.matched_regexp(search_conds) return [color.color_regexp(matchreg, gloss) for gloss in self.glosses] else: return [gloss for gloss in self.glosses]
def fmt_glosses(self, search_conds=None): '''Return list of formatted strings, one per gloss.''' if search_conds and search_conds.field == 'gloss': matchreg = search.matched_regexp(search_conds) return [ color.color_regexp(matchreg, gloss) for gloss in self.glosses ] else: return [gloss for gloss in self.glosses]
def fmt(self, search_conds=None): if search_conds and search_conds.field == 'kanji': matchreg = search.matched_regexp(search_conds) t = color.color_regexp(matchreg, self.text, 'kanji', 'matchjp') else: t = fmt(self.text, 'kanji') if self.ke_inf: t = t + fmt('[' + self.ke_inf + ']', 'subdue') return t
def fmt(self, search_conds=None): if self.romaji: t = self.romaji(self.text) else: t = self.text if search_conds and search_conds.field == 'reading': matchreg = search.matched_regexp(search_conds) t = color.color_regexp(matchreg, t, 'reading', 'matchjp') else: t = fmt(t, 'reading') if self.re_nokanji: t = fmt('*', 'subdue') + t if self.re_inf: t = t + fmt('[' + self.re_inf + ']', 'subdue') return t