From 12c3a9e4bb35f52dfa69a95bda16bd02394a8d16 Mon Sep 17 00:00:00 2001 From: dece Date: Mon, 13 Dec 2021 16:13:37 +0100 Subject: [PATCH] Gemtext: just trim most whitespaces for simplicity --- app/src/main/java/dev/lowrespalmtree/comet/Gemtext.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/dev/lowrespalmtree/comet/Gemtext.kt b/app/src/main/java/dev/lowrespalmtree/comet/Gemtext.kt index 959401b..1ac3ab6 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/Gemtext.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/Gemtext.kt @@ -57,8 +57,8 @@ private fun parseLine(line: CharBuffer, isPreformatted: Boolean): Line = line.startsWith("* ") -> ListItemLine(getCharsFrom(line, 2)) line.startsWith("=>") -> getCharsFrom(line, 2) .split(" ", limit = 2) - .run { LinkLine(get(0), if (size == 2) get(1) else "") } + .run { LinkLine(get(0), if (size == 2) get(1).trimStart() else "") } else -> if (isPreformatted) PreTextLine(line.toString()) else ParagraphLine(line.toString()) } -private fun getCharsFrom(line: CharBuffer, index: Int) = line.substring(index).trimStart() \ No newline at end of file +private fun getCharsFrom(line: CharBuffer, index: Int) = line.substring(index).trim() \ No newline at end of file