Store rendered side in TemplateRenderContext (#1852)
* Store rendered side in TemplateRenderContext * Move _question_side up with the other simple properties (dae)
This commit is contained in:
parent
68482d37a1
commit
45b12ca104
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user