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

Lack of Styling on Anki Cards Added via Memento #213

Open wlckd opened 2 months ago

wlckd commented 2 months ago

When utilizing Memento to add Anki cards, there seems to be an absence of styling applied to the cards. However, this styling is correctly applied when using Yomitan.

Memento: memento

Yomitan: yomitan

Version of Memento: 1.2.2

ripose-jp commented 2 months ago

I've never used Yomitan before. Is the styling you're using applied by your cards or Yomitan?

wlckd commented 2 months ago

Yomitan is a fork of yomichan now that it's no longer maintained. https://github.com/themoeway/yomitan

Yomitan applies the styling itself, from my understanding, it's all stored in the dict. (https://jitendex.org/)

I should've specified, but it's not just in anki, it's the same in the popup, in yomitan it renders with style, but in memento it's unstyled.

Memento: 2024-04-11_21-50 Yomitan: 2024-04-11_21-50_1

Here is the glossary field for both: Memento:

<div style="text-align: left;">
    <ol>
        <li><i>(★, Jitendex.org [2024-03-04])</i>
            <ul>
                <li>
                    <div><span style="font-weight: bold;font-size: 0.8em;vertical-align: text-bottom;"
                            data-code="n">noun</span><span
                            style="font-weight: bold;font-size: 0.8em;vertical-align: text-bottom;"
                            data-code="hon">honorific</span>
                        <div>
                            <ul data-content="glossary">
                                <li>all</li>
                                <li>everyone</li>
                                <li>everybody</li>
                            </ul>
                            <ul>
                                <li data-content="example-sentence-a"><span data-content="example-keyword"><ruby>皆さん<rt>
                                                <span style="">●●●</span></rt></ruby></span>じっとしていてください。</li>
                                <li data-content="example-sentence-b">Could you keep still, everyone?</li>
                            </ul>
                        </div>
                    </div>
                    <div style="font-size: 0.7em;" data-content="attribution"><a>JMdict</a>|<a>Tatoeba</a></div>
                </li>
            </ul>
        </li>
    </ol>
</div>

Yomitan:

<div style="text-align: left;"><i>(★, Jitendex.org [2024-03-04])</i> <span>
        <div><span data-sc-code="n"
                style="font-weight: bold; font-size: 0.8em; color: white; background-color: rgb(86, 86, 86); vertical-align: text-bottom; border-radius: 0.3em; margin-right: 0.25rem; padding: 0.2em 0.3em; word-break: keep-all; cursor: help;"
                title="noun (common) (futsuumeishi)">noun</span><span data-sc-code="hon"
                style="font-weight: bold; font-size: 0.8em; color: white; background-color: brown; vertical-align: text-bottom; border-radius: 0.3em; margin-right: 0.25rem; padding: 0.2em 0.3em; word-break: keep-all; cursor: help;"
                title="honorific or respectful (sonkeigo) language">honorific</span>
            <div>
                <ul data-sc-content="glossary">
                    <li>all</li>
                    <li>everyone</li>
                    <li>everybody</li>
                </ul>
                <ul style="margin-bottom: 0.5em; list-style-type: none;">
                    <li data-sc-content="example-sentence-a"
                        style="font-size: 130%; border-style: none none none solid; border-radius: 0.4rem 0px 0px; margin-top: 0.5rem; padding-left: 0.75rem;"
                        lang="ja"><span data-sc-content="example-keyword"><ruby>皆さん<rt><span
                                        style="color: crimson;">●●●</span></rt></ruby></span>じっとしていてください。</li>
                    <li data-sc-content="example-sentence-b"
                        style="font-size: 80%; border-style: none none none solid; border-radius: 0px 0px 0px 0.4rem; padding-left: 0.75rem;">
                        Could you keep still, everyone?</li>
                </ul>
            </div>
        </div>
        <div data-sc-content="attribution" style="font-size: 0.7em; text-align: right;"><a
                href="https://www.edrdg.org/jmwsgi/entr.py?svc=jmdict&amp;q=1202170"><span>JMdict</span><span
                    style="display:none;"></span></a> | <a
                href="https://tatoeba.org/en/sentences/show/195074"><span>Tatoeba</span><span
                    style="display:none;"></span></a></div>
    </span></div>
ripose-jp commented 2 months ago

I know what Yomitan is, I just haven't switched over yet since I'm lazy. I don't know how much I'll be able to fix Yomitan dictionary styling in Memento due to the limitations of Qt's HTML renderer, but I can give it a look. Seems like Yomitan has changed a lot of dictionary formatting from Yomichan, which was what Memento was built to be compatible with.

wlckd commented 2 months ago

I figured there might be a technical restriction, but thought I'd report it at least as unfortunately it's out of my depth. Appreciate you taking the time to look at it, and all the work you've done on memento