diff options
| author | Matttttt <18152455+martholomew@users.noreply.github.com> | 2024-05-28 20:33:36 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-28 19:33:36 +0000 | 
| commit | 83966376d0a3ed107c75020f6e2adfa80fcfcb06 (patch) | |
| tree | 95d362617f1bda56d18a0ee4c89676de76f8f52c /ext/js | |
| parent | 3bfd56bbe46a4f2ee9c66f0c7baeec3c6292718c (diff) | |
Removed normalizeTermOrReading (#985)
* removed normalizeTermOrReading
As it is not enabled, and enabling it would lead to unintended behavior for dictionaries, it makes sense to get rid of it.
Signed-off-by: Matttttt <18152455+martholomew@users.noreply.github.com>
* Re-added ternary operator
Signed-off-by: Matttttt <18152455+martholomew@users.noreply.github.com>
---------
Signed-off-by: Matttttt <18152455+martholomew@users.noreply.github.com>
Diffstat (limited to 'ext/js')
| -rw-r--r-- | ext/js/dictionary/dictionary-importer.js | 20 | 
1 files changed, 2 insertions, 18 deletions
| diff --git a/ext/js/dictionary/dictionary-importer.js b/ext/js/dictionary/dictionary-importer.js index f0c92481..98612d9e 100644 --- a/ext/js/dictionary/dictionary-importer.js +++ b/ext/js/dictionary/dictionary-importer.js @@ -615,8 +615,7 @@ export class DictionaryImporter {       */      _convertTermBankEntryV1(entry, dictionary) {          let [expression, reading, definitionTags, rules, score, ...glossary] = entry; -        expression = this._normalizeTermOrReading(expression); -        reading = this._normalizeTermOrReading(reading.length > 0 ? reading : expression); +        reading = reading.length > 0 ? reading : expression;          return {expression, reading, definitionTags, rules, score, glossary, dictionary};      } @@ -627,8 +626,7 @@ export class DictionaryImporter {       */      _convertTermBankEntryV3(entry, dictionary) {          let [expression, reading, definitionTags, rules, score, glossary, sequence, termTags] = entry; -        expression = this._normalizeTermOrReading(expression); -        reading = this._normalizeTermOrReading(reading.length > 0 ? reading : expression); +        reading = reading.length > 0 ? reading : expression;          return {expression, reading, definitionTags, rules, score, glossary, sequence, termTags, dictionary};      } @@ -784,20 +782,6 @@ export class DictionaryImporter {      }      /** -     * @param {string} text -     * @returns {string} -     */ -    _normalizeTermOrReading(text) { -        // Note: this function should not perform String.normalize on the text, -        // as it will normalize characters in an undesirable way. -        // Thus, this function is currently a no-op. -        // Example: -        // - '\u9038'.normalize('NFC') => '\u9038' (逸) -        // - '\ufa67'.normalize('NFC') => '\u9038' (逸 => 逸) -        return text; -    } - -    /**       * @template [T=unknown]       * @param {import('@zip.js/zip.js').Entry} entry       * @param {import('@zip.js/zip.js').Writer<T>|import('@zip.js/zip.js').WritableWriter} writer |