Skip to content

Commit 53f3969

Browse files
committed
refactor(DisplayComponent): strip HTML using Jsoup, add Apache Commons Text for XML entity unescaping #218
Update `DisplayComponent` to use Jsoup for HTML stripping and include Apache Commons Text library for unescaping XML entities. This change improves the reliability of text processing by utilizing specialized libraries.
1 parent 50f3c8b commit 53f3969

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@ project(":") {
434434
// token count
435435
implementation("com.knuddels:jtokkit:1.0.0")
436436

437+
implementation("org.apache.commons:commons-text:1.12.0")
438+
437439
// junit
438440
testImplementation("io.kotest:kotest-assertions-core:5.7.2")
439441
testImplementation("junit:junit:4.13.2")

src/main/kotlin/cc/unitmesh/devti/gui/component/DisplayComponent.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ class DisplayComponent(question: String) : JEditorPane() {
3030
}
3131

3232
private fun stripHtmlAndUnescapeXmlEntities(input: String): String {
33-
// 使用 Jsoup 去除HTML标签
3433
val text = Jsoup.parse(input).text()
35-
// 使用 Apache Commons Text 解码XML实体
3634
return StringEscapeUtils.unescapeXml(text)
3735
}
3836
}

0 commit comments

Comments
 (0)