summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-05-21 13:08:27 -0400
committerGitHub <noreply@github.com>2024-05-21 17:08:27 +0000
commit6998ebeee2f68158428ee58de2e77fcf658e53ab (patch)
tree5ed1685c39d3b0c12cec7479098ab7d6095d45b5 /ext
parent1cdc1c943e54d1b1dbf7db71ac763044e3523616 (diff)
Remove No pitch accent data from pitch handlebars (#982)
* Remove No pitch accent data from pitch handlebars * Update tests * Fix newline
Diffstat (limited to 'ext')
-rw-r--r--ext/data/templates/anki-field-templates-upgrade-v37.handlebars33
-rw-r--r--ext/data/templates/default-anki-field-templates.handlebars2
-rw-r--r--ext/js/data/options-util.js11
3 files changed, 43 insertions, 3 deletions
diff --git a/ext/data/templates/anki-field-templates-upgrade-v37.handlebars b/ext/data/templates/anki-field-templates-upgrade-v37.handlebars
new file mode 100644
index 00000000..b6effdda
--- /dev/null
+++ b/ext/data/templates/anki-field-templates-upgrade-v37.handlebars
@@ -0,0 +1,33 @@
+{{<<<<<<<}}
+{{#*inline "pitch-accent-list"}}
+ {{~#if (op ">" pitchCount 0)~}}
+ {{~#if (op ">" pitchCount 1)~}}<ol>{{~/if~}}
+ {{~#each pitches~}}
+ {{~#each pitches~}}
+ {{~#if (op ">" ../../pitchCount 1)~}}<li>{{~/if~}}
+ {{~> pitch-accent-item-disambiguation~}}
+ {{~> pitch-accent-item format=../../format~}}
+ {{~#if (op ">" ../../pitchCount 1)~}}</li>{{~/if~}}
+ {{~/each~}}
+ {{~/each~}}
+ {{~#if (op ">" pitchCount 1)~}}</ol>{{~/if~}}
+ {{~else~}}
+ No pitch accent data
+ {{~/if~}}
+{{/inline}}
+{{=======}}
+{{#*inline "pitch-accent-list"}}
+ {{~#if (op ">" pitchCount 0)~}}
+ {{~#if (op ">" pitchCount 1)~}}<ol>{{~/if~}}
+ {{~#each pitches~}}
+ {{~#each pitches~}}
+ {{~#if (op ">" ../../pitchCount 1)~}}<li>{{~/if~}}
+ {{~> pitch-accent-item-disambiguation~}}
+ {{~> pitch-accent-item format=../../format~}}
+ {{~#if (op ">" ../../pitchCount 1)~}}</li>{{~/if~}}
+ {{~/each~}}
+ {{~/each~}}
+ {{~#if (op ">" pitchCount 1)~}}</ol>{{~/if~}}
+ {{~/if~}}
+{{/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 bbeff830..7b4f3802 100644
--- a/ext/data/templates/default-anki-field-templates.handlebars
+++ b/ext/data/templates/default-anki-field-templates.handlebars
@@ -257,8 +257,6 @@
{{~/each~}}
{{~/each~}}
{{~#if (op ">" pitchCount 1)~}}</ol>{{~/if~}}
- {{~else~}}
- No pitch accent data
{{~/if~}}
{{/inline}}
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index e2fd2789..2dc23229 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -543,7 +543,8 @@ export class OptionsUtil {
this._updateVersion33,
this._updateVersion34,
this._updateVersion35,
- this._updateVersion36
+ this._updateVersion36,
+ this._updateVersion37
];
/* eslint-enable @typescript-eslint/unbound-method */
if (typeof targetVersion === 'number' && targetVersion < result.length) {
@@ -1296,6 +1297,14 @@ export class OptionsUtil {
}
/**
+ * - Removed `No pitch accent data` return from pitch handlebars when no data is found
+ * @type {import('options-util').UpdateFunction}
+ */
+ async _updateVersion37(options) {
+ await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v37.handlebars');
+ }
+
+ /**
* @param {string} url
* @returns {Promise<chrome.tabs.Tab>}
*/