Gemtext: fix link line parsing

Yes you can use tabs as separators…
This commit is contained in:
dece 2022-01-09 23:02:48 +01:00
parent afd0b42c83
commit 809db8f324

View file

@ -63,7 +63,7 @@ private fun parseLine(line: CharBuffer, isPreformatted: Boolean): Line =
line.startsWith(">") -> getCharsFrom(line, 1) // eh empty lines in quotes… line.startsWith(">") -> getCharsFrom(line, 1) // eh empty lines in quotes…
.run { if (isBlank()) EmptyLine() else BlockquoteLine(this) } .run { if (isBlank()) EmptyLine() else BlockquoteLine(this) }
line.startsWith("=>") -> getCharsFrom(line, 2) line.startsWith("=>") -> getCharsFrom(line, 2)
.split(" ", limit = 2) .split(" ", "\t", limit = 2)
.run { LinkLine(get(0), if (size == 2) get(1).trimStart() else "") } .run { LinkLine(get(0), if (size == 2) get(1).trimStart() else "") }
isPreformatted -> PreTextLine(line.toString()) isPreformatted -> PreTextLine(line.toString())
line.isEmpty() -> EmptyLine() line.isEmpty() -> EmptyLine()