Skip to content

Commit

Permalink
anki template upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 committed Jan 17, 2024
1 parent ff67a5b commit 6325c29
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
52 changes: 52 additions & 0 deletions ext/data/templates/anki-field-templates-upgrade-v24.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{#*inline "phonetic-transcriptions"}}
{{~#if (op ">" definition.phoneticTranscriptions.length 0)~}}
<ul>
{{~#each definition.phoneticTranscriptions~}}
{{~#each phoneticTranscriptions~}}
<li>
{{~set "any" false~}}
{{~#each tags~}}
{{~#if (get "any")}}, {{else}}<i>({{/if~}}
{{name}}
{{~set "any" true~}}
{{~/each~}}
{{~#if (get "any")}})</i> {{/if~}}
{{ipa~}}
</li>
{{~/each~}}
{{~/each~}}
</ul>
{{~/if~}}
{{/inline}}

{{<<<<<<<}}
{{#*inline "conjugation"}}
{{~#if (op ">" definition.inflectionRuleChainCandidates.length 0)~}}
{{~set "multiple" false~}}
{{~#if (op ">" definition.inflectionRuleChainCandidates.length 1)~}}
{{~set "multiple" true~}}
{{~/if~}}
{{~#if (get "multiple")~}}<ul>{{/if~}}
{{~#each definition.inflectionRuleChainCandidates~}}
{{~#if (op ">" inflectionRules.length 0)~}}
{{~#if (get "multiple")~}}<li>{{/if~}}
{{~#each inflectionRules~}}
{{~#if (op ">" @index 0)}} « {{/if~}}
{{.}}
{{~/each~}}
{{~#if (get "multiple")~}}</li>{{/if~}}
{{~/if~}}
{{~/each~}}
{{~#if (get "multiple")~}}</ul>{{/if~}}
{{~/if~}}
{{/inline}}
{{=======}}
{{#*inline "conjugation"}}
{{~#if definition.reasons~}}
{{~#each definition.reasons~}}
{{~#if (op ">" @index 0)}} « {{/if~}}
{{.}}
{{~/each~}}
{{~/if~}}
{{/inline}}
{{>>>>>>>>}}
4 changes: 3 additions & 1 deletion ext/js/data/options-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,9 @@ export class OptionsUtil {
* - Added dictionaries[].useDeinflections.
* @type {import('options-util').UpdateFunction}
*/
_updateVersion24(options) {
async _updateVersion24(options) {
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v24.handlebars');

for (const {options: profileOptions} of options.profiles) {
for (const dictionary of profileOptions.dictionaries) {
dictionary.useDeinflections = true;
Expand Down

0 comments on commit 6325c29

Please sign in to comment.