mpv2oboeru

mpv helpers to create flashcards from movies and TV shows
git clone anongit@rnpnr.xyz:mpv2oboeru.git
Log | Files | Refs | Feed | README | LICENSE

Commit: f50882c5ed33a741b708aedecdd2df38e8edbb31
Parent: 448ecf2c221f8d19e8fe40daf2d336ee585fdfe9
Author: Ren Tatsumoto
Date:   Tue, 23 Mar 2021 14:28:35 +0300

support any type of highlighting

Diffstat:
Msubs2srs.lua | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -343,11 +343,11 @@ local function update_sentence(new_data, stored_data) -- adds support for TSCs -- https://tatsumoto-ren.github.io/blog/discussing-various-card-templates.html#targeted-sentence-cards-or-mpvacious-cards -- if the target word was marked by yomichan, this function makes sure that the highlighting doesn't get erased. - local _, target, _ = stored_data[config.sentence_field]:match('^(.-)<b>(.-)</b>(.-)$') + local _, opentag, target, closetag, _ = stored_data[config.sentence_field]:match('^(.-)(<[^>]+>)(.-)(</[^>]+>)(.-)$') if target then local prefix, _, suffix = new_data[config.sentence_field]:match(table.concat { '^(.-)(', target, ')(.-)$' }) if prefix and suffix then - new_data[config.sentence_field] = table.concat { prefix, '<b>', target, '</b>', suffix } + new_data[config.sentence_field] = table.concat { prefix, opentag, target, closetag, suffix } end end return new_data