summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2022-02-02 20:09:13 -0500
committerGitHub <noreply@github.com>2022-02-02 20:09:13 -0500
commit258f1b629a9098a771e9ce58b217fa414d3ecf29 (patch)
treef1d34958e2cdb778536165deec4734b5cd31cf2f /ext
parentdea018670c666754991bed23f67a254aef6950c6 (diff)
Update sentence termination characters (#2059)
* Add vertical punctuation to terminationCharacters * Upgrade settings * Update tests
Diffstat (limited to 'ext')
-rw-r--r--ext/data/schemas/options-schema.json6
-rw-r--r--ext/js/data/options-util.js28
2 files changed, 32 insertions, 2 deletions
diff --git a/ext/data/schemas/options-schema.json b/ext/data/schemas/options-schema.json
index d15b533b..5c01f9f8 100644
--- a/ext/data/schemas/options-schema.json
+++ b/ext/data/schemas/options-schema.json
@@ -1019,7 +1019,11 @@
{"enabled": true, "character1": "。", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "!", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "?", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
- {"enabled": true, "character1": "…", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true}
+ {"enabled": true, "character1": "…", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
+ {"enabled": true, "character1": "︒", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
+ {"enabled": true, "character1": "︕", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
+ {"enabled": true, "character1": "︖", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
+ {"enabled": true, "character1": "︙", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true}
]
}
}
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index 7a725005..e2e4d739 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -465,7 +465,8 @@ class OptionsUtil {
{async: true, update: this._updateVersion13.bind(this)},
{async: false, update: this._updateVersion14.bind(this)},
{async: false, update: this._updateVersion15.bind(this)},
- {async: false, update: this._updateVersion16.bind(this)}
+ {async: false, update: this._updateVersion16.bind(this)},
+ {async: false, update: this._updateVersion17.bind(this)}
];
if (typeof targetVersion === 'number' && targetVersion < result.length) {
result.splice(targetVersion);
@@ -898,4 +899,29 @@ class OptionsUtil {
}
return options;
}
+
+ _updateVersion17(options) {
+ // Version 17 changes:
+ // Added vertical sentence punctuation to terminationCharacters.
+ const additions = ['︒', '︕', '︖', '︙'];
+ for (const profile of options.profiles) {
+ const {terminationCharacters} = profile.options.sentenceParsing;
+ const newAdditions = [];
+ for (const character of additions) {
+ if (terminationCharacters.findIndex((value) => (value.character1 === character && value.character2 === null)) < 0) {
+ newAdditions.push(character);
+ }
+ }
+ for (const character of newAdditions) {
+ terminationCharacters.push({
+ enabled: true,
+ character1: character,
+ character2: null,
+ includeCharacterAtStart: false,
+ includeCharacterAtEnd: true
+ });
+ }
+ }
+ return options;
+ }
}