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: 800e4a4279aad8c977c9bcecfa69321f2f258b23
Parent: 3fc928bec2609408b987e7a05ad6df70851c354e
Author: Ren Tatsumoto
Date:   Tue, 10 Nov 2020 09:21:24 +0300

separate code that removes spaces

Diffstat:
Msubs2srs.lua | 16+++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -177,18 +177,20 @@ local function contains_non_latin_letters(str) return str:match("[^%c%p%s%w]") end +local function remove_spaces(str) + if config.nuke_spaces == true and contains_non_latin_letters(str) then + return remove_all_spaces(str) + else + return remove_leading_trailing_spaces(str) + end +end + local function trim(str) str = remove_text_in_parentheses(str) str = remove_newlines(str) str = escape_apostrophes(str) str = escape_quotes(str) - - if config.nuke_spaces == true and contains_non_latin_letters(str) then - str = remove_all_spaces(str) - else - str = remove_leading_trailing_spaces(str) - end - + str = remove_spaces(str) return str end