Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve popup dictionary styling #220

Open
spacehamster opened this issue May 6, 2024 · 3 comments
Open

Improve popup dictionary styling #220

spacehamster opened this issue May 6, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@spacehamster
Copy link

I'd like to see make improvements to Memento's dictionary definition display to bring it more in line with Yomitan. More specifically, I would like to see proper support for Yomichan's compact glossaries, compact tags and better support for structured-content dictionary data. This includes quite a few separate changes:

  • In compact glossaries mode, pitch accent entries should be a single line separated by '|'
  • In compact glossaries mode, structured content glossaries be on the same line as the definition (part of speech, etc) tags
  • In compact glossaries mode, <ul> list entries should be on a single line separated by '|'
  • In compact tags mode, tags should be omitted if they are included in the previous entry.
  • Some dictionaries (such as Jitendex) do not include <rp> tags in the ruby markup. Ruby rendering should be improved. Options include stripping <rt> tags entirely, highlighting ruby kanji and showing kana on hover as a tooltip, or rendering them inline with brackets.
  • Add support for links. Should links open up a new popup or use the existing popup?
  • Various styling options are allowed in structured content. Many of them should be ignored due to limitations in QLabel's html rendering engine, but some of them can be implemented.
  • Show tooltip when clicking a tag in addition to hover.
  • This is a really minor thing, but I'd like the option to hide the checkboxes.
  • Why is there a separate option for "Bullet Points" and "Line Breaks" in the Separate Glossary Entries setting? Structured Content allows <div> an <br> tags as well as arbitrary Unicode strings for <li> list markers. It seems like that choice should left to the dictionary.

This is partially related to anki styling #213 as many of these points also apply, but because Qt and Anki html rendering have very different capabilities, it seems appropriate they should be handled separately.

Example of yomitan and memento side by side for JMDict and Jitendex

image

I can have a go at making a pull request if you're interested.

@ripose-jp ripose-jp added the enhancement New feature or request label May 7, 2024
@ripose-jp
Copy link
Owner

Some dictionaries (such as Jitendex) do not include <rp> tags in the ruby markup. Ruby rendering should be improved. Options include stripping <rt> tags entirely, highlighting ruby kanji and showing kana on hover as a tooltip, or rendering them inline with brackets.

All three of these options are desirable, though I like rendering them inline with brackets the least since it gets in the way of readability. Tooltips can be implemented in a hacky way by making tooltip'd text a link and using linkHovered() to show a tooltip.

Add support for links. Should links open up a new popup or use the existing popup?

By links, do you mean clicking a word opens a sub-search of sorts? I'm not against the idea. Opening it in a new popup would be the easiest thing to do since recursive search is already supported. You'd just have to listen for linkActiviated() and construct a new popup similarly to know recursive search does so. You can also make it work like clicking kanji in glossaries does, but that's probably more trouble than it's worth. Both are valid approaches.

Why is there a separate option for "Bullet Points" and "Line Breaks" in the Separate Glossary Entries setting? Structured Content allows <div> an <br> tags as well as arbitrary Unicode strings for <li> list markers. It seems like that choice should left to the dictionary.

Memento is older than Yomitan by several years. Yomitan has changed Yomichan's dictionaries quite a lot, which Memento hasn't kept up with. Very few of Yomichan's dictionaries used structured content, instead opting for plaintext. Most dictionaries used \n to separate different definitions under the same glossary. Older versions of Memento would turn these into bulleted lists. Calvin didn't like the unused white space to the left of bullets, so he made #64.

I believe the choice is mostly left to the dictionary if it's using structured content. These settings have an outsized effect on plaintext dictionaries.


If I didn't comment on something, it's because I'm okay with the change/improvement. If you want to work on some of them and make PR's, by all means go ahead.

@spacehamster
Copy link
Author

By links, do you mean clicking a word opens a sub-search of sorts?

Structured content allows dictionaries to specify <a> tags which can be either sub-search or links to external websites. Yomitan uses the same popup, but I have no issues with the way Memento currently opens a new popup for recursive search.

The structured content format looks like this

{
  "tag": "a",
  "lang": "ja",
  "href": "?query=日曜&wildcards=off",
  "content": [ <snip> ]
}

image

@ripose-jp
Copy link
Owner

Makes sense to me. I'd say reuse the code for recursive search since that's going to be really easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants