aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-27 22:53:45 -0400
committerGitHub <noreply@github.com>2020-03-27 22:53:45 -0400
commita0c4ce779d35cab39c62ca42ad3fe58a82faa1bb (patch)
treecd5cdae9d1a7aa48c11668a30758c72e4decedc7 /ext/bg/js/backend.js
parent08d38d8db2c97ff9f016a6de640f645b609088d1 (diff)
parent780d23b749325da0a95aa9cc7898df19f2ac1b31 (diff)
Merge pull request #413 from toasted-nutbread/japanese-utility
Convert Japanese utilities to a module-like style
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 978c5a4a..b217e64d 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -32,9 +32,7 @@
* dictEnabledSet
* dictTermsSort
* handlebarsRenderDynamic
- * jpConvertReading
- * jpDistributeFuriganaInflected
- * jpKatakanaToHiragana
+ * jp
* optionsLoad
* optionsSave
* profileConditionsDescriptor
@@ -402,13 +400,13 @@ class Backend {
dictTermsSort(definitions);
const {expression, reading} = definitions[0];
const source = text.substring(0, sourceLength);
- for (const {text: text2, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) {
- const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode);
+ for (const {text: text2, furigana} of jp.distributeFuriganaInflected(expression, reading, source)) {
+ const reading2 = jp.convertReading(text2, furigana, options.parsing.readingMode);
term.push({text: text2, reading: reading2});
}
text = text.substring(source.length);
} else {
- const reading = jpConvertReading(text[0], null, options.parsing.readingMode);
+ const reading = jp.convertReading(text[0], null, options.parsing.readingMode);
term.push({text: text[0], reading});
text = text.substring(1);
}
@@ -427,16 +425,16 @@ class Backend {
for (const {expression, reading, source} of parsedLine) {
const term = [];
if (expression !== null && reading !== null) {
- for (const {text: text2, furigana} of jpDistributeFuriganaInflected(
+ for (const {text: text2, furigana} of jp.distributeFuriganaInflected(
expression,
- jpKatakanaToHiragana(reading),
+ jp.convertKatakanaToHiragana(reading),
source
)) {
- const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode);
+ const reading2 = jp.convertReading(text2, furigana, options.parsing.readingMode);
term.push({text: text2, reading: reading2});
}
} else {
- const reading2 = jpConvertReading(source, null, options.parsing.readingMode);
+ const reading2 = jp.convertReading(source, null, options.parsing.readingMode);
term.push({text: source, reading: reading2});
}
result.push(term);