handle apos; html entity

This commit is contained in:
Adam Brown 2022-11-01 10:37:31 +00:00
parent 58730470f6
commit 1bfc2fd670
2 changed files with 9 additions and 3 deletions

View File

@ -56,7 +56,7 @@ class RichMessageParser {
} }
private fun String.removeHtmlEntities() = this.replace(""", "\"").replace("'", "'") private fun String.removeHtmlEntities() = this.replace(""", "\"").replace("'", "'").replace("'", "'")
private fun String.dropTextFallback() = this.lines() private fun String.dropTextFallback() = this.lines()
.dropWhile { it.startsWith("> ") || it.isEmpty() } .dropWhile { it.startsWith("> ") || it.isEmpty() }

View File

@ -38,8 +38,14 @@ class RichMessageParserTest {
@Test @Test
fun `replaces apostrophe entity`() = runParserTest( fun `replaces apostrophe entity`() = runParserTest(
Case(
input = "Hello world! foo's bar", input = "Hello world! foo's bar",
expected = RichText(listOf(Normal("Hello world! foo's bar"))) expected = RichText(listOf(Normal("Hello world! foo's bar")))
),
Case(
input = "Hello world! foo's bar",
expected = RichText(listOf(Normal("Hello world! foo's bar")))
),
) )
@Test @Test