diff --git a/pylib/anki/template.py b/pylib/anki/template.py index ed63516b4..3c0267949 100644 --- a/pylib/anki/template.py +++ b/pylib/anki/template.py @@ -158,6 +158,7 @@ class TemplateRenderContext: self._fill_empty = fill_empty self._fields: dict | None = None self._latex_svg = False + self._question_side: bool = True if not notetype: self._note_type = note.note_type() else: @@ -167,6 +168,10 @@ class TemplateRenderContext: # hooks, you can insert it into this dictionary self.extra_state: dict[str, Any] = {} + @property + def question_side(self) -> bool: + return self._question_side + def col(self) -> anki.collection.Collection: return self._col @@ -226,9 +231,11 @@ class TemplateRenderContext: answer_av_tags=[], ) + self._question_side = True qtext = apply_custom_filters(partial.qnodes, self, front_side=None) qout = self.col()._backend.extract_av_tags(text=qtext, question_side=True) + self._question_side = False atext = apply_custom_filters(partial.anodes, self, front_side=qout.text) aout = self.col()._backend.extract_av_tags(text=atext, question_side=False)