Gemtext: just trim most whitespaces for simplicity

This commit is contained in:
dece 2021-12-13 16:13:37 +01:00
parent 44629dd3ad
commit f8cfe2ad09

View file

@ -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()
private fun getCharsFrom(line: CharBuffer, index: Int) = line.substring(index).trim()