aboutsummaryrefslogtreecommitdiff
path: root/ext/data/templates
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-05-12 22:16:02 -0400
committerGitHub <noreply@github.com>2024-05-13 02:16:02 +0000
commit81390468b95e786e2aabb41ddcbdd91ab9b345c3 (patch)
tree763894899f3a60f1c346cb34377d3c9f3b9b99de /ext/data/templates
parent0b02bf46c9fac64287b1fce338927e34b87f4144 (diff)
Add glossary-first handlebars (#921)24.5.13.0
* Add glossary-first handlebars * Add docs * Fix missing /if * Write handlebars test data
Diffstat (limited to 'ext/data/templates')
-rw-r--r--ext/data/templates/anki-field-templates-upgrade-v35.handlebars33
-rw-r--r--ext/data/templates/default-anki-field-templates.handlebars24
2 files changed, 57 insertions, 0 deletions
diff --git a/ext/data/templates/anki-field-templates-upgrade-v35.handlebars b/ext/data/templates/anki-field-templates-upgrade-v35.handlebars
new file mode 100644
index 00000000..e71efcf8
--- /dev/null
+++ b/ext/data/templates/anki-field-templates-upgrade-v35.handlebars
@@ -0,0 +1,33 @@
+{{<<<<<<<}}
+{{#*inline "glossary-brief"}}
+ {{~> glossary brief=true ~}}
+{{/inline}}
+{{=======}}
+{{#*inline "glossary-brief"}}
+ {{~> glossary brief=true ~}}
+{{/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-no-dictionary"}}
+ {{~> glossary-first noDictionaryTag=true ~}}
+{{/inline}}
+
+{{#*inline "glossary-first-brief"}}
+ {{~> glossary-first brief=true ~}}
+{{/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 3f20f8ee..53dab1c1 100644
--- a/ext/data/templates/default-anki-field-templates.handlebars
+++ b/ext/data/templates/default-anki-field-templates.handlebars
@@ -141,6 +141,30 @@
{{~> glossary brief=true ~}}
{{/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-no-dictionary"}}
+ {{~> glossary-first noDictionaryTag=true ~}}
+{{/inline}}
+
+{{#*inline "glossary-first-brief"}}
+ {{~> glossary-first brief=true ~}}
+{{/inline}}
+
{{#*inline "kunyomi"}}
{{~#each definition.kunyomi}}{{.}}{{#unless @last}}, {{/unless}}{{/each~}}
{{/inline}}