Commit: 6f3ff61b483f3b0663d550d752a293587c258517
Parent: c4174c39c19cc88acd40a7bf46059fcfaefe285d
Author: Ren Tatsumoto
Date: Wed, 11 Nov 2020 18:31:34 +0300
move trim to subs.get()
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -340,9 +340,6 @@ local function construct_media_filenames(timings)
end
local function construct_note_fields(sub_text, snapshot_filename, audio_filename)
- if not is_empty(sub_text) then
- sub_text = trim(sub_text)
- end
return {
[config.sentence_field] = sub_text,
[config.image_field] = string.format('<img src="%s" alt="snapshot">', snapshot_filename),
@@ -900,6 +897,10 @@ subs.get = function()
if sub['start'] > sub['end'] then
sub['start'], sub['end'] = sub['end'], sub['start']
end
+ if not is_empty(sub['text']) then
+ sub['text'] = trim(sub['text'])
+ sub['text'] = escape_special_characters(sub['text'])
+ end
return sub
end