incremented matching group due to added matching group

added nbsp entity
This commit is contained in:
David Kaspar
2024-04-23 19:59:12 +02:00
parent c0aea75c16
commit 94af0eb220

View File

@@ -141,6 +141,8 @@ object MetaTagsParser {
"LT" to "<", "LT" to "<",
"gt" to ">", "gt" to ">",
"GT" to ">", "GT" to ">",
"nbsp" to " ",
"NBSP" to " ",
) )
val CHAR_REFS = val CHAR_REFS =
mapOf( mapOf(
@@ -157,6 +159,7 @@ object MetaTagsParser {
"mdash" to "", "mdash" to "",
"hellip" to "", "hellip" to "",
"x27" to "'", "x27" to "'",
"nbsp" to " ",
) )
fun replaceCharRefs(match: MatchResult): String { fun replaceCharRefs(match: MatchResult): String {
@@ -165,7 +168,7 @@ object MetaTagsParser {
return bcr return bcr
} }
// non-base char refs must be terminated by ';' // non-base char refs must be terminated by ';'
if (match.groupValues[2].isNotEmpty()) { if (match.groupValues[3].isNotEmpty()) {
val cr = CHAR_REFS[match.groupValues[2]] val cr = CHAR_REFS[match.groupValues[2]]
if (cr != null) { if (cr != null) {
return cr return cr