Fix furigana distribution when reading starts with expression, but has remainder characters (#1496)

This commit is contained in:
toasted-nutbread 2021-03-06 15:49:07 -05:00 committed by GitHub
parent aa6a547da7
commit a65742a884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -531,7 +531,7 @@ const JapaneseUtil = (() => {
_segmentizeFurigana(reading, readingNormalized, groups, groupsStart) {
const groupCount = groups.length - groupsStart;
if (groupCount <= 0) {
return [];
return reading.length === 0 ? [] : null;
}
const group = groups[groupsStart];

View File

@ -707,6 +707,13 @@ function testDistributeFurigana() {
{text: 'サボ', furigana: ''},
{text: 'る', furigana: 'ル'}
]
],
// Reading starts with expression, but has remainder characters
[
['シック', 'シック・ビルしょうこうぐん'],
[
{text: 'シック', furigana: 'シック・ビルしょうこうぐん'}
]
]
];