Relax the requirement that post entities match their value

zio/stable
Paul Frazee 2022-11-29 09:35:10 -06:00
parent 57f2d1d59f
commit 2ccbe4f702
1 changed files with 2 additions and 7 deletions

View File

@ -81,13 +81,8 @@ function* toSegments(text: string, entities: Entity[]) {
}
if (currEnt.index.start < currEnt.index.end) {
let subtext = text.slice(currEnt.index.start, currEnt.index.end)
if (
!subtext.trim() ||
(currEnt.type === 'mention' &&
stripUsername(subtext) !== stripUsername(currEnt.value)) ||
(currEnt.type === 'link' && !isSameLink(subtext, currEnt.value))
) {
// dont yield links to empty strings or strings that don't match the entity value
if (!subtext.trim()) {
// dont yield links to empty strings
yield subtext
} else {
yield {