summaryrefslogtreecommitdiff
path: root/ext/data
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2024-05-05 02:30:09 +0200
committerGitHub <noreply@github.com>2024-05-05 00:30:09 +0000
commit2d191bfdbd955a363e7afdc79c7a2b4b11a2e9b7 (patch)
treeeb3706b9ed98ba5347612088821ae046a0719fc8 /ext/data
parentc3c5d58688a411c6ed450b89494c59037197df55 (diff)
add single dictionary handlebars (#814)24.5.5.0
* add single dictionary handlebars * fix dicts with kanji in title * sort * rename to single-glossary-XYZ * add brief and no dict variants * add docs, only terms no kanji * allow testing single dict handlebars * remove empty comment
Diffstat (limited to 'ext/data')
-rw-r--r--ext/data/templates/anki-field-templates-upgrade-v34.handlebars59
-rw-r--r--ext/data/templates/default-anki-field-templates.handlebars20
2 files changed, 76 insertions, 3 deletions
diff --git a/ext/data/templates/anki-field-templates-upgrade-v34.handlebars b/ext/data/templates/anki-field-templates-upgrade-v34.handlebars
new file mode 100644
index 00000000..5538df85
--- /dev/null
+++ b/ext/data/templates/anki-field-templates-upgrade-v34.handlebars
@@ -0,0 +1,59 @@
+{{<<<<<<<}}
+{{~#*inline "glossary"~}}
+ <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)~}}
+ <ol>{{~#each definition.definitions~}}<li>{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}</li>{{~/each~}}</ol>
+ {{~else~}}
+ {{~#each definition.definitions~}}{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}{{~/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;">
+ {{~#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~}}
+{{>>>>>>>}} \ No newline at end of file
diff --git a/ext/data/templates/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars
index 3ca7ba18..3f20f8ee 100644
--- a/ext/data/templates/default-anki-field-templates.handlebars
+++ b/ext/data/templates/default-anki-field-templates.handlebars
@@ -101,12 +101,26 @@
<div style="text-align: left;">
{{~#scope~}}
{{~#if (op "===" definition.type "term")~}}
- {{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}}
+ {{~#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~}}<li>{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}</li>{{~/each~}}</ol>
+ <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~}}{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}{{~/each~}}
+ {{~#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)~}}