From 066e4bf4bc38b4ae57d62c2144ba6c7a23f35f17 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Mon, 15 Jan 2024 20:52:49 +0100 Subject: [PATCH] fix: preserve Migaku Option settings on base tmpl --- src/note_type_mgr.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/note_type_mgr.py b/src/note_type_mgr.py index 71fa676..2580219 100644 --- a/src/note_type_mgr.py +++ b/src/note_type_mgr.py @@ -111,14 +111,16 @@ def field_exists(name): # Set template html if template: for fmt, html_name in [("qfmt", "front.html"), ("afmt", "back.html")]: - if nt["name"] == NOTE_TYPE_PREFIX + lang.name_en: + fields_settings = nt_get_tmpl_fields_settings(nt, template_idx, fmt) + + # The base template is always reset to the default: + # User may not change it, except for setting Migaku Options which are applied by the nt_set_tmpl_lang call below + if is_base_tmpl: html_path = lang.file_path("card", html_name) with open(html_path, "r", encoding="utf-8") as file: html = file.read() nt["tmpls"][template_idx][fmt] = html - fields_settings = nt_get_tmpl_fields_settings(nt, template_idx, fmt) - nt_set_tmpl_lang( nt, lang,