Closed JDEngi closed 2 years ago
I'm setting up a debian dev enviroment to run the tests and will recommit to this pull request once my fix passes the tests
The below code works for me. It defines an Anki model that includes a {{furigana:Answer}}
field on the backside of the card. When I run it and import foo.apkg
into Anki, this is what the card looks like:
So I think everything is working as expected.
I'm not sure what has changed since you filed this issue. If this is still a problem for you, could you provide some code that triggers the issue?
I also added this code as a test in https://github.com/kerrickstaley/genanki/commit/0c34ba402b331a5db78e0968ad9eb10898af64db
my_model = genanki.Model(
1523004567,
'Japanese',
fields=[
{'name': 'Question'},
{'name': 'Answer'},
],
templates=[
{
'name': 'Card 1',
'qfmt': '{{Question}}',
'afmt': '{{FrontSide}}<hr id="answer">{{furigana:Answer}}',
},
])
my_note = genanki.Note(
model=my_model,
fields=['kanji character', '漢字[かんじ]'])
my_deck = genanki.Deck(1702181380, 'Japanese')
my_deck.add_note(my_note)
my_deck.write_to_file('/tmp/foo.apkg')
I discovered that I couldn't generate any cards if I used either {{kanji:Word}} or {{furigana:Word}} in the qfmt field of a template.
I deducted that "pystache.render(....)" wasn't able to render the sentinal value into the template because of the prepended option.
I cleaned out the option using a regex subtitution and tested this implementation successfully in my own project.