Skip to content

Commit

Permalink
fix: preserve Migaku Option settings on base tmpl
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiesel committed Jan 15, 2024
1 parent 4aba7d5 commit 066e4bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/note_type_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 066e4bf

Please sign in to comment.