themoeway / yomitan

Pop-up dictionary browser extension. Successor to Yomichan.
https://yomitan.wiki
GNU General Public License v3.0
1.19k stars 94 forks source link

Request for adding more features to `{selection-text}` #1172

Open bewizible opened 3 months ago

bewizible commented 3 months ago

As of now, {selection-text} does only one thing, return the text selected by user. I would like to humbly request for two more features to be included into this handlebar, namely

  1. {selection-text} to ignore selected text IF it is the same as vocab, this is so it can be used with the Yomitan Search Page.
  2. {selection-text} to have a dictionary override too, for example, if you want to choose a certain definition in its entirely you could just select the dictionaries title (in the tag) and have it be the text gone into the field using selection-text instead of manually selecting the entire definition.

Adding this feature to selection-text would make it more nicer to use. Thanks very much!

Kuuuube commented 3 months ago

For point 1 what issues with the search page are you having? I dont see any reason this request is specific to the search page. Unless theres something more to this, it's out of scope of yomitan and you should configure that on your anki card template instead.

For point 2 we do have the single dictionary handlebars. You could also set that up with every dict in a different field and only show the one from selection text in your anki card template.

bewizible commented 3 months ago

Thank you for your prompt response and for the incredible work on Yomitan. I'd like to address your points and provide further clarification on my feature requests.

For point 1 what issues with the search page are you having? I don't see any reason this request is specific to the search page. Unless there's something more to this, it's out of scope of Yomitan and you should configure that on your Anki card template instead.

As far as I understand, this issue seems to occur specifically on the Yomitan Search Page. I believe this might be because the entire page is treated as a popup. However, my technical knowledge of Yomitan's code is limited, so I might be mistaken. This issue affects the field using selection-text on the search page.

Here's an example of how it looks on the page, which appears fine: image

But this is what gets exported to the card: image

Interestingly, this issue doesn't occur if I select other text within the definition, which then becomes the selection text instead of the word highlighted by Yomitan. However, I prefer not to manually select text for every definition. As someone who uses manga_ocr to read manga and the Yomitan Search Page extensively, I encounter this issue frequently. It would be wonderful if this could be addressed.

For point 2 we do have the single dictionary handlebars. You could also set that up with every dict in a different field and only show the one from selection text in your Anki card template.

Yes, the single dictionary handlebars are fantastic and have made me switch from JPMN. I currently use them in my card as follows:

However, I sometimes find myself in situations where I would like the entire content of a specific dictionary added to a field. Selecting the entire content manually can break the formatting, which, while not always, happens often enough to be an inconvenience. This is why I'm requesting an enhancement to the handlebar functionality.

Creating a separate handlebar that works in conjunction with selection-text would be ideal. For example, {new-handlebar}{selection-text} where:

This addition would greatly enhance the usability and flexibility of the handlebars.

Thank you very much for considering these suggestions. Your efforts are greatly appreciated!