mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(metadata): Simplify code
This commit is contained in:
parent
a2d6ac2a8b
commit
fbe2d8c701
2 changed files with 10 additions and 9 deletions
|
@ -29,7 +29,7 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
|
||||||
- Fixed reader sometimes won't load images
|
- Fixed reader sometimes won't load images
|
||||||
- Handle some uncaught crashes
|
- Handle some uncaught crashes
|
||||||
- Fixed crashes due to GestureDetector's firstEvent is sometimes null on some devices
|
- Fixed crashes due to GestureDetector's firstEvent is sometimes null on some devices
|
||||||
- Fixed download failed caused by invalid XML 1.0 character
|
- Fixed download failed due to invalid XML 1.0 character
|
||||||
- Fixed issues with shizuku in a multi user setup (@Redjard)
|
- Fixed issues with shizuku in a multi user setup (@Redjard)
|
||||||
|
|
||||||
### Other
|
### Other
|
||||||
|
|
|
@ -234,12 +234,13 @@ enum class ComicInfoPublishingStatus(
|
||||||
}
|
}
|
||||||
|
|
||||||
// REF: https://www.w3.org/TR/xml/#charsets
|
// REF: https://www.w3.org/TR/xml/#charsets
|
||||||
fun String.stripNonValidXML1_0Characters(): String {
|
fun String.stripNonValidXML1_0Characters() = filter { it.isValidXML1_0() }
|
||||||
return this.filter {
|
|
||||||
val c = it.code
|
fun Char.isValidXML1_0() = code.let { c ->
|
||||||
c == 0x9 || c == 0xA || c == 0xD ||
|
c == 0x9 ||
|
||||||
((c >= 0x20) && (c <= 0xD7FF)) ||
|
c == 0xA ||
|
||||||
((c >= 0xE000) && (c <= 0xFFFD)) ||
|
c == 0xD ||
|
||||||
((c >= 0x10000) && (c <= 0x10FFFF))
|
c in 0x20..0xD7FF ||
|
||||||
}
|
c in 0xE000..0xFFFD ||
|
||||||
|
c in 0x10000..0x10FFFF
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue