forked from FooSoft/yomichan
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support css file in dictionaries (#1080)
* get styles in db * get styles in settings * use styles * fix test * scope * fix comma separated * escape dict name in css selector * g regex * get styles in anki * fix tests * more specificity * whitespace * test importing * test handlebars * add styles to glossary-first
- Loading branch information
1 parent
1a866b3
commit d2c930a
Showing
26 changed files
with
1,255 additions
and
664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
ext/data/templates/anki-field-templates-upgrade-v41.handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{{<<<<<<<}} | ||
{{~#*inline "glossary"~}} | ||
<div style="text-align: left;"> | ||
{{~#scope~}} | ||
{{~#if (op "===" definition.type "term")~}} | ||
{{~#unless (op "&&" selectedDictionary (op "!=" selectedDictionary definition.dictionary))~}} | ||
{{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}} | ||
{{~/unless~}} | ||
{{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}} | ||
{{~#if (op ">" definition.definitions.length 1)~}} | ||
<ol> | ||
{{~#each definition.definitions~}} | ||
{{~#unless (op "&&" ../selectedDictionary (op "!=" ../selectedDictionary dictionary))~}} | ||
<li> | ||
{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}} | ||
</li> | ||
{{~/unless~}} | ||
{{~/each~}} | ||
</ol> | ||
{{~else~}} | ||
{{~#each definition.definitions~}} | ||
{{~#unless (op "&&" ../selectedDictionary (op "!=" ../selectedDictionary dictionary))~}} | ||
{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}} | ||
{{~/unless~}} | ||
{{~/each~}} | ||
{{~/if~}} | ||
{{~else if (op "===" definition.type "kanji")~}} | ||
{{~#if (op ">" definition.glossary.length 1)~}} | ||
<ol>{{#each definition.glossary}}<li>{{.}}</li>{{/each}}</ol> | ||
{{~else~}} | ||
{{~#each definition.glossary~}}{{.}}{{~/each~}} | ||
{{~/if~}} | ||
{{~/if~}} | ||
{{~/scope~}} | ||
</div> | ||
{{~/inline~}} | ||
{{=======}} | ||
{{~#*inline "glossary"~}} | ||
<div style="text-align: left;" class="yomitan-glossary"> | ||
{{~#scope~}} | ||
{{~#if (op "===" definition.type "term")~}} | ||
{{~#unless (op "&&" selectedDictionary (op "!=" selectedDictionary definition.dictionary))~}} | ||
{{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}} | ||
{{~#if definition.glossaryScopedStyles~}} | ||
<style>{{{definition.glossaryScopedStyles}}}</style> | ||
{{~/if~}} | ||
{{~/unless~}} | ||
{{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}} | ||
{{~#if (op ">" definition.definitions.length 1)~}} | ||
<ol> | ||
{{~#each definition.definitions~}} | ||
{{~#unless (op "&&" ../selectedDictionary (op "!=" ../selectedDictionary dictionary))~}} | ||
<li data-dictionary="{{dictionary}}"> | ||
{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}} | ||
</li> | ||
{{~#if dictScopedStyles~}} | ||
<style>{{{dictScopedStyles}}}</style> | ||
{{~/if~}} | ||
{{~/unless~}} | ||
{{~/each~}} | ||
</ol> | ||
{{~else~}} | ||
{{~#each definition.definitions~}} | ||
{{~#unless (op "&&" ../selectedDictionary (op "!=" ../selectedDictionary dictionary))~}} | ||
{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}} | ||
{{~#if glossaryScopedStyles~}} | ||
<style>{{{glossaryScopedStyles}}}</style> | ||
{{~/if~}} | ||
{{~/unless~}} | ||
{{~/each~}} | ||
{{~/if~}} | ||
{{~else if (op "===" definition.type "kanji")~}} | ||
{{~#if (op ">" definition.glossary.length 1)~}} | ||
<ol>{{#each definition.glossary}}<li>{{.}}</li>{{/each}}</ol> | ||
{{~else~}} | ||
{{~#each definition.glossary~}}{{.}}{{~/each~}} | ||
{{~/if~}} | ||
{{~/if~}} | ||
{{~/scope~}} | ||
</div> | ||
{{~/inline~}} | ||
{{>>>>>>>}} | ||
|
||
{{<<<<<<<}} | ||
{{~#*inline "glossary-first"~}} | ||
<div style="text-align: left;"> | ||
{{~#scope~}} | ||
{{~#if (op "===" definition.type "term")~}} | ||
{{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}} | ||
{{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}} | ||
{{~#if (op ">" definition.definitions.length 1)~}} | ||
{{~#with definition.definitions.[0]~}}{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}{{~/with~}} | ||
{{~else~}} | ||
{{~#with definition.definitions.[0]~}}{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}{{~/with~}} | ||
{{~/if~}} | ||
{{~/if~}} | ||
{{~/scope~}} | ||
</div> | ||
{{~/inline~}} | ||
{{=======}} | ||
{{~#*inline "glossary-first"~}} | ||
<div style="text-align: left;" class="yomitan-glossary"> | ||
{{~#scope~}} | ||
{{~#if (op "===" definition.type "term")~}} | ||
{{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}} | ||
{{~#if definition.glossaryScopedStyles~}} | ||
<style>{{{definition.glossaryScopedStyles}}}</style> | ||
{{~/if~}} | ||
{{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}} | ||
{{~#if (op ">" definition.definitions.length 1)~}} | ||
{{~#with definition.definitions.[0]~}} | ||
{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}} | ||
{{~#if glossaryScopedStyles~}} | ||
<style>{{{glossaryScopedStyles}}}</style> | ||
{{~/if~}} | ||
{{~/with~}} | ||
{{~else~}} | ||
{{~#with definition.definitions.[0]~}} | ||
{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}} | ||
{{~#if glossaryScopedStyles~}} | ||
<style>{{{glossaryScopedStyles}}}</style> | ||
{{~/if~}} | ||
{{~/with~}} | ||
{{~/if~}} | ||
{{~/if~}} | ||
{{~/scope~}} | ||
</div> | ||
{{~/inline~}} | ||
{{>>>>>>>}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.