yomichan/ext/data/templates/anki-field-templates-upgrade-v10.handlebars
toasted-nutbread 90f7d5ba07
Add part of speech info (#1561)
* Add part of speech info to headwords

* Expose parts of speech to Anki template rendering

* Expose parts of speech

* Update pitch accent categories

* Update docs

* Add part-of-speech

* Update options and tests

* Update markers

* Update test data
2021-03-26 19:50:54 -04:00

31 lines
1.1 KiB
Handlebars

{{#*inline "part-of-speech-pretty"}}
{{~#if (op "===" . "v1")~}}Ichidan verb
{{~else if (op "===" . "v5")~}}Godan verb
{{~else if (op "===" . "vk")~}}Kuru verb
{{~else if (op "===" . "vs")~}}Suru verb
{{~else if (op "===" . "vz")~}}Zuru verb
{{~else if (op "===" . "adj-i")~}}I-adjective
{{~else if (op "===" . "n")~}}Noun
{{~else~}}{{.}}
{{~/if~}}
{{/inline}}
{{#*inline "part-of-speech"}}
{{~#scope~}}
{{~#if (op "!==" definition.type "kanji")~}}
{{~#set "first" true}}{{/set~}}
{{~#each definition.expressions~}}
{{~#each wordClasses~}}
{{~#unless (get (concat "used_" .))~}}
{{~> part-of-speech-pretty . ~}}
{{~#unless (get "first")}}, {{/unless~}}
{{~#set (concat "used_" .) true~}}{{~/set~}}
{{~#set "first" false~}}{{~/set~}}
{{~/unless~}}
{{~/each~}}
{{~/each~}}
{{~#if (get "first")~}}Unknown{{~/if~}}
{{~/if~}}
{{~/scope~}}
{{/inline}}