From: David ‘Bombe’ Roden Date: Fri, 16 Sep 2011 10:26:53 +0000 (+0200) Subject: Fix parser. X-Git-Tag: 0.7^2~6 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=1a5d3c00f9e9a14f5e3ffcd0a329cc98cddde16a;ds=sidebyside Fix parser. --- diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 4195516..0c20abe 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -177,7 +177,11 @@ public class SoneTextParser implements Parser { } if (linkType == LinkType.SONE) { if (next > 0) { - parts.add(new PlainTextPart(line.substring(0, next))); + if (lineComplete && !lastLineEmpty) { + parts.add(new PlainTextPart("\n" + line.substring(0, next))); + } else { + parts.add(new PlainTextPart(line.substring(0, next))); + } } if (line.length() >= (next + 7 + 43)) { String soneId = line.substring(next + 7, next + 50); @@ -192,6 +196,7 @@ public class SoneTextParser implements Parser { parts.add(new PlainTextPart(line.substring(next))); line = ""; } + lineComplete = false; continue; } if (linkType == LinkType.POST) {