Fix furigana distribution when reading starts with expression, but has remainder characters (#1496)
This commit is contained in:
parent
aa6a547da7
commit
a65742a884
@ -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];
|
||||
|
@ -707,6 +707,13 @@ function testDistributeFurigana() {
|
||||
{text: 'サボ', furigana: ''},
|
||||
{text: 'る', furigana: 'ル'}
|
||||
]
|
||||
],
|
||||
// Reading starts with expression, but has remainder characters
|
||||
[
|
||||
['シック', 'シック・ビルしょうこうぐん'],
|
||||
[
|
||||
{text: 'シック', furigana: 'シック・ビルしょうこうぐん'}
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user