chore: lint performance optimization

This includes shadowed variables, unnecessary parameters, layouts with string literals, items that cause performance bottlenecks, and the merge of extension types into only the necessary separate classes.
This commit is contained in:
TwistedUmbrellaX 2024-03-14 09:23:30 -04:00
parent 958aa634b1
commit 37ec165319
111 changed files with 1561 additions and 2091 deletions

View file

@ -6,7 +6,7 @@ import ani.dantotsu.util.ColorEditor.Companion.toHexColor
class AniMarkdown { //istg anilist has the worst api
companion object {
private fun convertNestedImageToHtml(markdown: String): String {
val regex = """\[\!\[(.*?)\]\((.*?)\)\]\((.*?)\)""".toRegex()
val regex = """\[!\[(.*?)]\((.*?)\)]\((.*?)\)""".toRegex()
return regex.replace(markdown) { matchResult ->
val altText = matchResult.groupValues[1]
val imageUrl = matchResult.groupValues[2]
@ -16,7 +16,7 @@ class AniMarkdown { //istg anilist has the worst api
}
private fun convertImageToHtml(markdown: String): String {
val regex = """\!\[(.*?)\]\((.*?)\)""".toRegex()
val regex = """!\[(.*?)]\((.*?)\)""".toRegex()
return regex.replace(markdown) { matchResult ->
val altText = matchResult.groupValues[1]
val imageUrl = matchResult.groupValues[2]
@ -25,7 +25,7 @@ class AniMarkdown { //istg anilist has the worst api
}
private fun convertLinkToHtml(markdown: String): String {
val regex = """\[(.*?)\]\((.*?)\)""".toRegex()
val regex = """\[(.*?)]\((.*?)\)""".toRegex()
return regex.replace(markdown) { matchResult ->
val linkText = matchResult.groupValues[1]
val linkUrl = matchResult.groupValues[2]
@ -50,7 +50,7 @@ class AniMarkdown { //istg anilist has the worst api
private fun underlineToHtml(html: String): String {
return html.replace("(?s)___(.*?)___".toRegex(), "<br><em><strong>$1</strong></em><br>")
.replace("(?s)__(.*?)__".toRegex(), "<br><strong>$1</strong><br>")
.replace("(?s)[\\s]+_([^_]+)_[\\s]+".toRegex(), "<em>$1</em>")
.replace("(?s)\\s+_([^_]+)_\\s+".toRegex(), "<em>$1</em>")
}
fun getBasicAniHTML(html: String): String {