Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,498 changes: 2,249 additions & 2,249 deletions ksoup-entites/src/commonMain/kotlin/com/mohamedrejeb/ksoup/entities/EntityMaps.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public object KsoupEntities {
* as the foundation for a custom translator.
*/
private val ENCODE_XML: StringTranslator = run {
val encodeXml11Map = mapOf(
val encodeXml11Map = listOf(
"\u0000" to "",
"\u000b" to "",
"\u000c" to "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package com.mohamedrejeb.ksoup.entities
* @param lookupMap Map<String, String> table of translator
* mappings
*/
internal class LookupTranslator(lookupMap: Map<String, String>) : StringTranslator() {
internal class LookupTranslator(lookupMap: List<Pair<String, String>>) : StringTranslator() {
/** The mapping to be used in translation. */
private val lookupMap: MutableMap<String, String> = mutableMapOf()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ internal object CharsUtils {
* {@code codePoint} is not a valid Unicode code point.
*/
fun toChars(codePoint: Int): CharArray {

return if (isBmpCodePoint(codePoint)) {
charArrayOf(codePoint.toChar())
} else if (isValidCodePoint(codePoint)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ class KsoupEntitesTest {
testDecodeHtml5("&nbsp;&nbsp;&nbsp;", "   ")
}

@Test
fun testDecodeHtml5_6() {
testDecodeHtml5("&Aring;", "Å")
}

// Encode Test

@Test
Expand Down Expand Up @@ -75,4 +80,9 @@ class KsoupEntitesTest {
testEncodeHtml5("   ", "&nbsp;&nbsp;&nbsp;")
}

@Test
fun testEncodeHtml5_6() {
testEncodeHtml5("Å", "&angst;")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,13 @@ class KsoupHtmlParserTest {
expectedString = "&ampa hhhdude test",
)
}

@Test
fun testWrongHtml3() {
runHtmlTest(
input = """<html><body>First line<br/>Second line</body></html>""",
expectedOpenTags = listOf("html", "body", "br"),
expectedString = "First lineSecond line",
)
}
}