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: cd4485daeebaa8e1100ccb3265a8db0bf900e2f1
Parent: 175e0d9137198c051517723f872cdbbb66d376e6
Author: Ren Tatsumoto
Date:   Thu, 21 Jan 2021 11:36:14 +0300

avoid removing whole lines if they're in parentheses

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

diff --git a/subs2srs.lua b/subs2srs.lua @@ -175,9 +175,10 @@ end local function remove_text_in_parentheses(str) -- Remove text like (泣き声) or (ドアの開く音) + -- No deletion is performed if there's no text after the parentheses. -- Note: the modifier `-´ matches zero or more occurrences. -- However, instead of matching the longest sequence, it matches the shortest one. - return str:gsub('%b()', ''):gsub('(.-)', '') + return str:gsub('(%b())(.)', '%2'):gsub('((.-))(.)', '%2') end local function remove_newlines(str)