FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 223 forks source link

dictionary won't import with image description tag? #2256

Closed Thermospore closed 1 year ago

Thermospore commented 1 year ago

hello, I'm working on adding images to a dictionary. if I add a description tag the dictionary won't import:

https://github.com/FooSoft/yomichan/blob/master/ext/data/schemas/dictionary-term-bank-v3-schema.json#L417

there seem to be two places that list image tags in the schema; I'm not quite sure what the difference is between them

dict with description dict without description

thanks

Thermospore commented 1 year ago

there seem to be two places that list image tags in the schema; I'm not quite sure what the difference is between them

it seems one is image and the other is img, and the latter lacks the description tag? image

edit: oh, and image is entirely outside of structured content?

toasted-nutbread commented 1 year ago

"img" tags do not use a "description" since the description is (supposed to be) just HTML text appended after the image.

The "image" content was the original way to create definitions that contained an image + text description, which predates structured content, so it exists for backwards compatibility.

Original source: https://github.com/FooSoft/yomichan/pull/446/files#diff-6bea760d0d7db1e71b7203e36bc82cf66a7b07cb4ce00b024c379a7e9944050cR254-R257

It looks like this functionality is currently "broken", and it doesn't actually use the field anymore, which is probably a bug. https://github.com/FooSoft/yomichan/blob/a47cbc39e24f0aa2a64e7e787657a0a777d11edb/ext/js/display/sandbox/structured-content-generator.js#L37-L52

toasted-nutbread commented 1 year ago

Actually, it looks like the "description" functionality is still there, I was just looking at the wrong spot.

https://github.com/FooSoft/yomichan/blob/a47cbc39e24f0aa2a64e7e787657a0a777d11edb/ext/js/display/display-generator.js#L353-L370

Thermospore commented 1 year ago

Ah I see, thanks for the info