From acc013a1a8051d34322f0f5f91d7bdecc0a18843 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 28 Jan 2024 07:22:47 -0500 Subject: JapaneseUtil refactor (#555) * Copy functions from JapaneseUtil * Remove JapaneseUtil * Update usages of JapaneseUtil functions --- ext/js/data/sandbox/anki-note-data-creator.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'ext/js/data/sandbox/anki-note-data-creator.js') diff --git a/ext/js/data/sandbox/anki-note-data-creator.js b/ext/js/data/sandbox/anki-note-data-creator.js index 5a608cd2..fc787a66 100644 --- a/ext/js/data/sandbox/anki-note-data-creator.js +++ b/ext/js/data/sandbox/anki-note-data-creator.js @@ -17,21 +17,13 @@ */ import {DictionaryDataUtil} from '../../dictionary/dictionary-data-util.js'; +import {distributeFurigana} from '../../language/japanese.js'; /** * This class is used to convert the internal dictionary entry format to the * format used by Anki, for backwards compatibility. */ export class AnkiNoteDataCreator { - /** - * Creates a new instance. - * @param {import('../../language/sandbox/japanese-util.js').JapaneseUtil} japaneseUtil An instance of `JapaneseUtil`. - */ - constructor(japaneseUtil) { - /** @type {import('../../language/sandbox/japanese-util.js').JapaneseUtil} */ - this._japaneseUtil = japaneseUtil; - } - /** * Creates a compatibility representation of the specified data. * @param {string} marker The marker that is being used for template rendering. @@ -860,7 +852,7 @@ export class AnkiNoteDataCreator { _getTermHeadwordFuriganaSegments(term, reading) { /** @type {import('anki-templates').FuriganaSegment[]} */ const result = []; - for (const {text, reading: reading2} of this._japaneseUtil.distributeFurigana(term, reading)) { + for (const {text, reading: reading2} of distributeFurigana(term, reading)) { result.push({text, furigana: reading2}); } return result; -- cgit v1.2.3