Commit: 709a121a523d70e2d46c7b3f3e60929164152102
Parent: bcd0cb735010370d8215681a98a84ba997e70135
Author: Ren Tatsumoto
Date: Mon, 14 Jun 2021 17:30:56 +0300
add a toggle for miscinfo_field
Diffstat:
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/.github/RELEASE/subs2srs.conf b/.github/RELEASE/subs2srs.conf
@@ -12,12 +12,6 @@ model_name=Japanese sentences
sentence_field=SentKanji
audio_field=SentAudio
image_field=Image
-miscinfo_field=Notes
-
-# Format string used to fill the miscinfo_field. It supports the same
-# substitutions as note_tag. HTML is supported.
-miscinfo_format=%n EP%d (%t)
-#miscinfo_format=From <b>mpvacious</b> %n at %t.
# The tag(s) added to new notes. Spaces separate multiple tags.
# Leave nothing after `=` to disable tagging completely.
@@ -121,3 +115,18 @@ vocab_field=VocabKanji
# Vocab Audio field should be equal to {audio} field in Yomichan
vocab_audio_field=VocabAudio
+
+#######################################
+# Misc info #
+#######################################
+
+# By enabling miscinfo you can add certain context information to your cards.
+miscinfo_enable=yes
+
+# Field name
+miscinfo_field=Notes
+
+# Format string used to fill the miscinfo_field.
+# It supports the same substitutions as note_tag. HTML is supported.
+miscinfo_format=%n EP%d (%t)
+#miscinfo_format=From <b>mpvacious</b> %n at %t.
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -75,6 +75,7 @@ local config = {
tag_filename_lowercase = false, -- convert filename to lowercase for tagging.
-- Misc info
+ miscinfo_enable = true,
miscinfo_field = "Notes", -- misc notes and source information field
miscinfo_format = "%n EP%d (%t)", -- format string to use for the miscinfo_field, accepts note_tag-style format strings
@@ -380,12 +381,15 @@ local function substitute_fmt(tag)
end
local function construct_note_fields(sub_text, snapshot_filename, audio_filename)
- return {
+ local ret = {
[config.sentence_field] = sub_text,
[config.image_field] = string.format('<img alt="snapshot" src="%s">', snapshot_filename),
[config.audio_field] = string.format('[sound:%s]', audio_filename),
- [config.miscinfo_field] = substitute_fmt(config.miscinfo_format),
}
+ if config.miscinfo_enable == true then
+ ret[config.miscinfo_field] = substitute_fmt(config.miscinfo_format)
+ end
+ return ret
end
local function minutes_ago(m)