summaryrefslogtreecommitdiff
path: root/ext/js/templates/template-renderer.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-04-13 20:32:24 -0400
committerGitHub <noreply@github.com>2021-04-13 20:32:24 -0400
commit609d4fe3347f87290a428e2ba1192acb991b2e38 (patch)
tree57a37b970bc5564ab7a958aa695b5351aecdb793 /ext/js/templates/template-renderer.js
parentbbf47865ffa616128543396c97aa861d8a423a36 (diff)
Replace furigana with reading (#1614)
* Use "reading" instead of "furigana" for reading distribution * Update tests
Diffstat (limited to 'ext/js/templates/template-renderer.js')
-rw-r--r--ext/js/templates/template-renderer.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/js/templates/template-renderer.js b/ext/js/templates/template-renderer.js
index ed9cc41c..9bb7a414 100644
--- a/ext/js/templates/template-renderer.js
+++ b/ext/js/templates/template-renderer.js
@@ -177,11 +177,11 @@ class TemplateRenderer {
const segs = this._japaneseUtil.distributeFurigana(expression, reading);
let result = '';
- for (const seg of segs) {
- if (seg.furigana.length > 0) {
- result += `<ruby>${seg.text}<rt>${seg.furigana}</rt></ruby>`;
+ for (const {text, reading: reading2} of segs) {
+ if (reading2.length > 0) {
+ result += `<ruby>${text}<rt>${reading2}</rt></ruby>`;
} else {
- result += seg.text;
+ result += text;
}
}
@@ -193,12 +193,12 @@ class TemplateRenderer {
const segs = this._japaneseUtil.distributeFurigana(expression, reading);
let result = '';
- for (const seg of segs) {
- if (seg.furigana.length > 0) {
+ for (const {text, reading: reading2} of segs) {
+ if (reading2.length > 0) {
if (result.length > 0) { result += ' '; }
- result += `${seg.text}[${seg.furigana}]`;
+ result += `${text}[${reading2}]`;
} else {
- result += seg.text;
+ result += text;
}
}