From 529fb1ead79be36631c7b299c64cfadf13dfc0ac Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Wed, 30 Jun 2021 23:56:30 +0200 Subject: [PATCH] * Simplified (english) gloss highlighting. --- jiten-pai.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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] = '' -- 2.30.2