mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
no longer try fields with : in their names
it's not supported by the card generation code, and the card layout screen will automatically fix note types
This commit is contained in:
parent
706ed225ca
commit
29e476f482
1 changed files with 5 additions and 14 deletions
|
@ -158,22 +158,13 @@ class Template:
|
||||||
@modifier(None)
|
@modifier(None)
|
||||||
def render_unescaped(self, tag_name=None, context=None) -> Any:
|
def render_unescaped(self, tag_name=None, context=None) -> Any:
|
||||||
"""Render a tag without escaping it."""
|
"""Render a tag without escaping it."""
|
||||||
txt = get_or_attr(context, tag_name)
|
# split out field modifiers
|
||||||
if txt is not None:
|
*mods, tag = tag_name.split(":")
|
||||||
# some field names could have colons in them
|
|
||||||
# avoid interpreting these as field modifiers
|
|
||||||
# better would probably be to put some restrictions on field names
|
|
||||||
return txt
|
|
||||||
|
|
||||||
# field modifiers
|
|
||||||
parts = tag_name.split(":")
|
|
||||||
extra = None
|
|
||||||
if len(parts) == 1 or parts[0] == "":
|
|
||||||
return "{unknown field %s}" % tag_name
|
|
||||||
else:
|
|
||||||
mods, tag = parts[:-1], parts[-1] # py3k has *mods, tag = parts
|
|
||||||
|
|
||||||
|
# return an error if field doesn't exist
|
||||||
txt = get_or_attr(context, tag)
|
txt = get_or_attr(context, tag)
|
||||||
|
if txt is None:
|
||||||
|
return "{unknown field %s}" % tag_name
|
||||||
|
|
||||||
# Since 'text:' and other mods can affect html on which Anki relies to
|
# Since 'text:' and other mods can affect html on which Anki relies to
|
||||||
# process clozes, we need to make sure clozes are always
|
# process clozes, we need to make sure clozes are always
|
||||||
|
|
Loading…
Reference in a new issue