Closed Weroxig closed 11 months ago
I have the same problem, happening only with Firefox, if I try switching to Chromium {glossary} works as expected
Using Firefox 117.0.1
@Weroxig I am trying to reproduce your issue to no avail. Are you using a custom Anki Card Template? Besides the exported settings file (thanks for that), can you also please provide:
You have an option to export your dictionary collection at (Settings -> Backup -> Export Dictionary Collection). The result should be a rather heavy file in the format yomitan-dictionaries-2023-10-03-13-24-26.json:
What I currently have is probably different than your setup (Settings -> Dictionaries -> Configure installed and enabled dictionaries...:
You can find the anki card template (handlebars) if you go to Settings -> Anki -> Configure Anki card templates..., inside the textbox. Make sure you copy all the contents until the last line inside the textbox and save it into a txt file:
@jarmanso7 all you need to reproduce is yomitan, firefox, a dictionary with structured data like JMdict Extra, and to test {glossary}
. i've reproduced this already.
@praschke Okay, I guess the missing part of the puzzle for me is JMdic Extra then. Thanks for the help, I'll try with that.
@praschke I was able to reproduce the issue. Thanks.
I've been investigating and I've hit a wall beyond which I'm unable to progress. This is what I've found out so far.
When creating an Anki card from Yomitan, at some point the function _renderTemplate at template-renderer.js is called. The value in the variable data
is identical when debugging for both Firefox and Chrome. However, on passing data
to instance(data)
(a function that corresponds to Handlebars.compileAST
at execution time) the values returned by this call and stored into the variable result
already differ between Firefox and Chrome:
_renderTemplate(instance, data) {
const renderSetup = this._renderSetup;
const renderCleanup = this._renderCleanup;
let result;
let additions1;
let additions2;
try {
additions1 = (typeof renderSetup === 'function' ? renderSetup(data) : null);
result = instance(data).trim();
} finally {
additions2 = (typeof renderCleanup === 'function' ? renderCleanup(data) : null);
}
return Object.assign({result}, additions1, additions2);
}
For this reason, I believe there's some problem in the Handlebars processing (it may be related to Fix Handlebars not working on Firefox due to eval #171).
It is very difficult to debug inside Handlebars.min.js. @Aquafina-water-bottle, can you provide a way or would you kindly point me to the right direction to be able to debug a beautified/pretty version of Handlebars.min.js? Is it worth it (I've seen in the mentioned issue that using this library is a temporary fix)?.
Thank you.
@jarmanso7 the sourcemap can be found at https://github.com/Aquafina-water-bottle/handlebars-noeval/raw/master/handlebars.min.js.map
jsyk, Aquafina hasn't been around for a while.
@praschke I will try to set the sourcemaps. I am not a frontend developer which means each new step I take I have to learn it on the go, but hopefully I can get it to work. Thanks your your help
@praschke Thank you very much!! I just came back here to let you guys know I ran out of time to continue to look into this issue, just to find it already solved. Thank you again.
Description
This is {glossary} for 読め (beautified)
Browser version Firefox nightly 119.0a1 (2023-09-20) I also tried Firefox stable 117.0.1 (64-bit)
Yomichan version 23.8.19.0
Exported settings file yomitan-settings-2023-09-23-06-58-13.zip