stephenmk / Jitendex

A free, offline, and openly licensed Japanese-to-English dictionary. Updates weekly!
https://jitendex.org
Creative Commons Attribution Share Alike 4.0 International
259 stars 3 forks source link

Yomitan Anki Card Templates #72

Closed bgs6 closed 8 months ago

bgs6 commented 8 months ago

I just switched to using yomitan for creating cards and I wondered if there is a card template that sends only the jitendex definition to anki.

I searched all day and all I could find is this one that sends the first dictionary:

{{~#*inline "one-dict"~}}
    {{~#scope~}}
        {{~#if (op "===" definition.type "term")~}}
            {{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}}
        {{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}}
            {{~> glossary-single definition.definitions.[0] brief=brief noDictionaryTag=noDictionaryTag ~}}
        {{~else if (op "===" definition.type "kanji")~}}
            {{definition.glossary.[0]}}
        {{~/if~}}
    {{~/scope~}}
{{~/inline~}}

{{#*inline "one-dict-no-dictionary"}}
    {{~> one-dict noDictionaryTag=true ~}}
{{/inline}}

{{#*inline "one-dict-brief"}}
    {{~> one-dict brief=true ~}}
{{/inline}}

However the no-dictionary doesn't work properly. The dictionary name Jitendex [2024-01-28] does get removed, but the "high priority entry" star doesn't.

The brief one does hide the star but I'm not sure whether it hides something else.

Also jitendex must be the first dictionary otherwise it obviously doesn't work.

It would be nice if we can get a bulletproof template for jitendex and put it in the wiki. I'm sure others will find that useful too.

stephenmk commented 8 months ago

I don't use or really understand handlebars, so I don't like the idea of putting this in the wiki here. If it breaks or users have a problem with it, people will come to me asking for help.

I think it makes sense to include custom styles in the wiki here because those styles only apply to jitendex. From what I understand, it sounds like this handlebar code could apply to any dictionary and doesn't really have anything to do with jitendex in particular. I think it would be better if the yomitan developers gave users the ability to choose which dictionaries get sent to anki and in what order.