ripose-jp / Memento

An mpv-based video player for studying Japanese
https://ripose-jp.github.io/Memento/
GNU General Public License v2.0
434 stars 21 forks source link

Yomichan Handlebar Support #79

Open eyalmazuz opened 2 years ago

eyalmazuz commented 2 years ago

(I swear that if I knew CPP and QT I would've helped implement stuff as I did with ames) Hi, I have 2 features suggestions that exist in yomichan I think would be great for Memento users (which I personally use)

  1. Moved to #80.

  2. handlebars, honestly I don't know what it does, but I'm using the handlebars script presented in animecards.site in my current mining deck and I think it creates a new setting you can use when adding cards to Anki. In QM sites, he uses {test} in the expression field to add the definitions of words, from my understanding what I think it does is that it parses the pop-up dictionary and only adds the first result out of all the ones that are available for the term

ripose-jp commented 2 years ago

I think recursive search would be relatively easy to implement.

Handlebars on the other hand look tough. From just the few examples I see, it looks like a Turring complete templating language. There are ifs, loops, and plenty of other logic in these that make them seem like a big ask: https://pastebin.com/TeSJc6ij.

From the https://animecards.site handlebar section:

All the default values you can use to import dictionary entries will use all entries from the dictionaries you have imported. This is not desirable and will create a big mess in your mined cards, forcing you to clean it up afterwards or deal with bad Anki cards. By editing the handlebars you can modify it to only use one entry however.

Memento doesn't have this problem since unlike Yomichan glossary entries can be excluded by unchecking them. There is also an option in Anki Integration settings that prevents entire dictionaries from being added to cards by default.

These handlebars add the {test} field and make the pitch accent graph white. You need to use {test} instead of {glossary} or {glossary-brief} in the card format options.

Memento's pitch graphs use the current text color, so there's no need to use handlebars to change their color.

Basically handlebars seem like a lot of work for really niche benefits, so I'm not going to prioritize working on them.

Also for the future, when you have two separate feature requests, open two issues so the issue tracker is easier to search.

eyalmazuz commented 2 years ago

Memento doesn't have this problem since unlike Yomichan glossary entries can be excluded by unchecking them. There is also an option in Anki Integration settings that prevents entire dictionaries from being added to cards by default.

Basically handlebars seem like a lot of work for really niche benefits, so I'm not going to prioritize working on them.

that makes sense, forgot about the unchecking option for glossary entries I think this feature can be abandoned for now, cause there's already a working alternative

Also for the future, when you have two separate feature requests, open two issues so the issue tracker is easier to search.

ラジャー o7

and again thank you very much for all your hard work

edit: I accidentally found this when I search handlebars js on google https://github.com/uranusjr/qthandlebarsjs

ripose-jp commented 2 years ago

edit: I accidentally found this when I search handlebars js on google https://github.com/uranusjr/qthandlebarsjs

It depends on QML, which Memento doesn't depend on. It also seems abandoned with some work still to be done, so that makes it a little less desirable as well. It is under MIT though, so I could do just about anything I want to it.

I think the better option though would be to use MuJS instead since mpv already depends on it, so Memento depending on it as well doesn't add any additional dependencies. With handlebarjs already written, this feature becomes much more feasible since I just need to writing bindings instead of an entire interpreter.

ElaxDev commented 1 year ago

Basically handlebars seem like a lot of work for really niche benefits, so I'm not going to prioritize working on them.

Is not only animecards that use handlebars there are other card templates that started using them, such as JPMN that is the one I use (https://aquafina-water-bottle.github.io/jp-mining-note/setupyomichan/#yomichan-templates) I think it would be a good addition since it would add more flexibility to the program.

eyalmazuz commented 1 week ago

Bumping this issue to see if there's any interest now to maybe implement this feature I recently moved to use jpmn mining note

and as mentioned in: https://github.com/ripose-jp/Memento/issues/195#issuecomment-1909740342

since memento doesn't support handlebars it can't be used directly with memento which a bit of shame since this type of notes are really good and allow for big versatility

I hope you might re-consider you stance on this feature

Thank you

ripose-jp commented 1 week ago

My stance hasn't really changed. If someone implements handlebar support using MuJs and it works well, I'll merge it. I don't personally have a use for this feature and it looks like a lot of work, so I probably won't be implementing it any time soon.