Gemtext: just trim most whitespaces for simplicity

This commit is contained in:
dece 2021-12-13 16:13:37 +01:00
parent 6381e40208
commit 12c3a9e4bb

View file

@ -57,8 +57,8 @@ private fun parseLine(line: CharBuffer, isPreformatted: Boolean): Line =
line.startsWith("* ") -> ListItemLine(getCharsFrom(line, 2)) line.startsWith("* ") -> ListItemLine(getCharsFrom(line, 2))
line.startsWith("=>") -> getCharsFrom(line, 2) line.startsWith("=>") -> getCharsFrom(line, 2)
.split(" ", limit = 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()) else -> if (isPreformatted) PreTextLine(line.toString()) else ParagraphLine(line.toString())
} }
private fun getCharsFrom(line: CharBuffer, index: Int) = line.substring(index).trimStart() private fun getCharsFrom(line: CharBuffer, index: Int) = line.substring(index).trim()