From: Urban Wallasch Date: Wed, 30 Jun 2021 21:56:30 +0000 (+0200) Subject: * Simplified (english) gloss highlighting. X-Git-Tag: v0.1.0~17 X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=529fb1ead79be36631c7b299c64cfadf13dfc0ac;p=jiten-pai.git * Simplified (english) gloss highlighting. --- diff --git a/jiten-pai.py b/jiten-pai.py index 23f4b36..a67967a 100755 --- a/jiten-pai.py +++ b/jiten-pai.py @@ -1450,9 +1450,6 @@ class jpMainWindow(QMainWindow): hlfmt = '' % cfg['hl_col'] html = [''] * (rlen + 2) html[0] = nfmt - def hl_repl(match, org=None): - grp = match.group(0) if org is None else org[match.span()[0]:match.span()[1]] - return '%s%s' % (hlfmt, grp) def hl_jap(rex, word): hlw = [] start = 0 @@ -1486,7 +1483,7 @@ class jpMainWindow(QMainWindow): headword = hl_jap(rex, headword) reading = hl_jap(rex, reading) else: - gloss = re_term.sub(hl_repl, gloss) + gloss = re_term.sub(lambda m: '%s%s'%(hlfmt,m.group(0)), gloss) # assemble display line html[idx+1] = '

%s%s%s%s %s

\n' % (verb_message, lfmt, headword, reading, gloss) html[rlen + 1] = ''