diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-11-12 20:34:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 20:34:11 -0500 |
commit | ec021964b7311d02fdbc5531564074f145043b91 (patch) | |
tree | 7d82366ed48e64c3dbad00e37a5f717134c59439 /ext/bg/data | |
parent | f2ad94e54f2a110bf93aebfae33c808c497005be (diff) |
Compact tags refactor (#1021)
* Update translator to flag redundant tags instead of remove
* Update how compact tags are shown in the popup
* Pass compactTags option to note builder
* Update options templates
* Add options upgrade
* Add options upgrade test
Diffstat (limited to 'ext/bg/data')
-rw-r--r-- | ext/bg/data/default-anki-field-templates.handlebars | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/ext/bg/data/default-anki-field-templates.handlebars b/ext/bg/data/default-anki-field-templates.handlebars index 776792c7..0b0e9ca6 100644 --- a/ext/bg/data/default-anki-field-templates.handlebars +++ b/ext/bg/data/default-anki-field-templates.handlebars @@ -1,6 +1,17 @@ {{#*inline "glossary-single"}} {{~#unless brief~}} - {{~#if definitionTags~}}<i>({{#each definitionTags}}{{name}}{{#unless @last}}, {{/unless}}{{/each}})</i> {{/if~}} + {{~#scope~}} + {{~#set "any" false}}{{/set~}} + {{~#if definitionTags~}}{{#each definitionTags~}} + {{~#if (op "||" (op "!" ../data.compactTags) (op "!" redundant))~}} + {{~#if (get "any")}}, {{else}}<i>({{/if~}} + {{name}} + {{~#set "any" true}}{{/set~}} + {{~/if~}} + {{~/each~}} + {{~#if (get "any")}})</i> {{/if~}} + {{~/if~}} + {{~/scope~}} {{~#if only~}}({{#each only}}{{{.}}}{{#unless @last}}, {{/unless}}{{/each}} only) {{/if~}} {{~/unless~}} {{~#if glossary.[1]~}} @@ -92,18 +103,18 @@ {{~else~}} {{~#if group~}} {{~#if definition.definitions.[1]~}} - <ol>{{#each definition.definitions}}<li>{{> glossary-single brief=../brief compactGlossaries=../compactGlossaries}}</li>{{/each}}</ol> + <ol>{{#each definition.definitions}}<li>{{> glossary-single brief=../brief compactGlossaries=../compactGlossaries data=../.}}</li>{{/each}}</ol> {{~else~}} - {{~> glossary-single definition.definitions.[0] brief=brief compactGlossaries=compactGlossaries~}} + {{~> glossary-single definition.definitions.[0] brief=brief compactGlossaries=compactGlossaries data=.~}} {{~/if~}} {{~else if merge~}} {{~#if definition.definitions.[1]~}} - <ol>{{#each definition.definitions}}<li>{{> glossary-single brief=../brief compactGlossaries=../compactGlossaries}}</li>{{/each}}</ol> + <ol>{{#each definition.definitions}}<li>{{> glossary-single brief=../brief compactGlossaries=../compactGlossaries data=../.}}</li>{{/each}}</ol> {{~else~}} - {{~> glossary-single definition.definitions.[0] brief=brief compactGlossaries=compactGlossaries~}} + {{~> glossary-single definition.definitions.[0] brief=brief compactGlossaries=compactGlossaries data=.~}} {{~/if~}} {{~else~}} - {{~> glossary-single definition brief=brief compactGlossaries=compactGlossaries~}} + {{~> glossary-single definition brief=brief compactGlossaries=compactGlossaries data=.~}} {{~/if~}} {{~/if~}} </div> |