From a81787c55b10b43344a9506b62d90c317b329667 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 28 Jan 2021 21:33:30 -0500 Subject: Remove the dictionary tag from the definitionTags (#1324) * Remove dictionary tag from term definitionTags and kanji tags * Update test data * Update templates * Update tests * Update information --- ext/bg/data/anki-field-templates-upgrade-v8.handlebars | 18 +++++++++++++++--- ext/bg/data/default-anki-field-templates.handlebars | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'ext/bg/data') diff --git a/ext/bg/data/anki-field-templates-upgrade-v8.handlebars b/ext/bg/data/anki-field-templates-upgrade-v8.handlebars index 32c61343..b3aed45f 100644 --- a/ext/bg/data/anki-field-templates-upgrade-v8.handlebars +++ b/ext/bg/data/anki-field-templates-upgrade-v8.handlebars @@ -52,6 +52,13 @@ {{~#set "any" true}}{{/set~}} {{~/if~}} {{~/each~}} + {{~#unless noDictionaryTag~}} + {{~#if (op "||" (op "!" @root.compactTags) (op "!==" dictionary (get "previousDictionary")))~}} + {{~#if (get "any")}}, {{else}}({{/if~}} + {{dictionary}} + {{~#set "any" true}}{{/set~}} + {{~/if~}} + {{~/unless~}} {{~#if (get "any")}}) {{/if~}} {{~/scope~}} {{~#if only~}}({{#each only}}{{.}}{{#unless @last}}, {{/unless}}{{/each}} only) {{/if~}} @@ -63,6 +70,7 @@ {{~else~}} {{~/if~}} + {{~#set "previousDictionary" dictionary~}}{{~/set~}} {{/inline}} {{>>>>>>>}} @@ -99,12 +107,12 @@
{{~#scope~}} {{~#if (op "===" definition.type "term")~}} - {{~> glossary-single definition brief=brief ~}} + {{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}} {{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}} {{~#if (op ">" definition.definitions.length 1)~}} -
    {{~#each definition.definitions~}}
  1. {{~> glossary-single . brief=../brief ~}}
  2. {{~/each~}}
+
    {{~#each definition.definitions~}}
  1. {{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}
  2. {{~/each~}}
{{~else~}} - {{~#each definition.definitions~}}{{~> glossary-single . brief=../brief ~}}{{~/each~}} + {{~#each definition.definitions~}}{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}{{~/each~}} {{~/if~}} {{~else if (op "===" definition.type "kanji")~}} {{~#if (op ">" definition.glossary.length 1)~}} @@ -116,4 +124,8 @@ {{~/scope~}}
{{~/inline~}} + +{{#*inline "glossary-no-dictionary"}} + {{~> glossary noDictionaryTag=true ~}} +{{/inline}} {{>>>>>>>}} diff --git a/ext/bg/data/default-anki-field-templates.handlebars b/ext/bg/data/default-anki-field-templates.handlebars index 94553183..8ee2e00d 100644 --- a/ext/bg/data/default-anki-field-templates.handlebars +++ b/ext/bg/data/default-anki-field-templates.handlebars @@ -9,6 +9,13 @@ {{~#set "any" true}}{{/set~}} {{~/if~}} {{~/each~}} + {{~#unless noDictionaryTag~}} + {{~#if (op "||" (op "!" @root.compactTags) (op "!==" dictionary (get "previousDictionary")))~}} + {{~#if (get "any")}}, {{else}}({{/if~}} + {{dictionary}} + {{~#set "any" true}}{{/set~}} + {{~/if~}} + {{~/unless~}} {{~#if (get "any")}}) {{/if~}} {{~/scope~}} {{~#if only~}}({{#each only}}{{.}}{{#unless @last}}, {{/unless}}{{/each}} only) {{/if~}} @@ -20,6 +27,7 @@ {{~else~}} {{~/if~}} + {{~#set "previousDictionary" dictionary~}}{{~/set~}} {{/inline}} {{#*inline "audio"}} @@ -93,12 +101,12 @@
{{~#scope~}} {{~#if (op "===" definition.type "term")~}} - {{~> glossary-single definition brief=brief ~}} + {{~> glossary-single definition brief=brief noDictionaryTag=noDictionaryTag ~}} {{~else if (op "||" (op "===" definition.type "termGrouped") (op "===" definition.type "termMerged"))~}} {{~#if (op ">" definition.definitions.length 1)~}} -
    {{~#each definition.definitions~}}
  1. {{~> glossary-single . brief=../brief ~}}
  2. {{~/each~}}
+
    {{~#each definition.definitions~}}
  1. {{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}
  2. {{~/each~}}
{{~else~}} - {{~#each definition.definitions~}}{{~> glossary-single . brief=../brief ~}}{{~/each~}} + {{~#each definition.definitions~}}{{~> glossary-single . brief=../brief noDictionaryTag=../noDictionaryTag ~}}{{~/each~}} {{~/if~}} {{~else if (op "===" definition.type "kanji")~}} {{~#if (op ">" definition.glossary.length 1)~}} @@ -111,6 +119,10 @@
{{~/inline~}} +{{#*inline "glossary-no-dictionary"}} + {{~> glossary2 noDictionaryTag=true ~}} +{{/inline}} + {{#*inline "glossary-brief"}} {{~> glossary brief=true ~}} {{/inline}} -- cgit v1.2.3