stripping out more html tags from text
This commit is contained in:
parent
04f1dfe7ca
commit
0a982ff53f
|
@ -64,10 +64,17 @@ fun String.stripTags() = this
|
||||||
}
|
}
|
||||||
.trim()
|
.trim()
|
||||||
.replaceLinks()
|
.replaceLinks()
|
||||||
.replace("<em>", "")
|
.removeTag("p")
|
||||||
.replace("</em>", "")
|
.removeTag("em")
|
||||||
|
.removeTag("strong")
|
||||||
|
.removeTag("code")
|
||||||
|
.removeTag("pre")
|
||||||
.replace(""", "\"")
|
.replace(""", "\"")
|
||||||
.replace("'", "'")
|
.replace("'", "'")
|
||||||
|
.replace("<br />", "\n")
|
||||||
|
.replace("<br/>", "\n")
|
||||||
|
|
||||||
|
private fun String.removeTag(name: String) = this.replace("<$name>", "").replace("/$name>", "")
|
||||||
|
|
||||||
private fun String.replaceLinks(): String {
|
private fun String.replaceLinks(): String {
|
||||||
return this.indexOfOrNull("<a href=")?.let { start ->
|
return this.indexOfOrNull("<a href=")?.let { start ->
|
||||||
|
|
Loading…
Reference in New Issue