aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/data
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-16 15:29:42 -0500
committerGitHub <noreply@github.com>2021-01-16 15:29:42 -0500
commitb2342945403c27e346446bbe316f075ed2b13eff (patch)
tree690a065de66ece5e0b395dbc2811d3d9fdbe13f9 /ext/bg/data
parent0ac35771192adb87d76809aff171d60a5d0018c3 (diff)
Stroke count marker (#1251)
* Add stroke-count definition * Update options * Update documentation * Add helper
Diffstat (limited to 'ext/bg/data')
-rw-r--r--ext/bg/data/anki-field-templates-upgrade-v8.handlebars14
-rw-r--r--ext/bg/data/default-anki-field-templates.handlebars15
2 files changed, 29 insertions, 0 deletions
diff --git a/ext/bg/data/anki-field-templates-upgrade-v8.handlebars b/ext/bg/data/anki-field-templates-upgrade-v8.handlebars
new file mode 100644
index 00000000..a5056364
--- /dev/null
+++ b/ext/bg/data/anki-field-templates-upgrade-v8.handlebars
@@ -0,0 +1,14 @@
+{{#*inline "stroke-count"}}
+ {{~#scope~}}
+ {{~#set "found" false}}{{/set~}}
+ {{~#each definition.stats.misc~}}
+ {{~#if (op "===" name "strokes")~}}
+ {{~#set "found" true}}{{/set~}}
+ Stroke count: {{value}}
+ {{~/if~}}
+ {{~/each~}}
+ {{~#if (op "!" (get "found"))~}}
+ Stroke count: Unknown
+ {{~/if~}}
+ {{~/scope~}}
+{{/inline}}
diff --git a/ext/bg/data/default-anki-field-templates.handlebars b/ext/bg/data/default-anki-field-templates.handlebars
index 1024e2e6..a0aff5d2 100644
--- a/ext/bg/data/default-anki-field-templates.handlebars
+++ b/ext/bg/data/default-anki-field-templates.handlebars
@@ -323,4 +323,19 @@
{{~/if~}}
{{/inline}}
+{{#*inline "stroke-count"}}
+ {{~#scope~}}
+ {{~#set "found" false}}{{/set~}}
+ {{~#each definition.stats.misc~}}
+ {{~#if (op "===" name "strokes")~}}
+ {{~#set "found" true}}{{/set~}}
+ Stroke count: {{value}}
+ {{~/if~}}
+ {{~/each~}}
+ {{~#if (op "!" (get "found"))~}}
+ Stroke count: Unknown
+ {{~/if~}}
+ {{~/scope~}}
+{{/inline}}
+
{{~> (lookup . "marker") ~}}