From 1a5d3c00f9e9a14f5e3ffcd0a329cc98cddde16a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 16 Sep 2011 12:26:53 +0200 Subject: [PATCH] Fix parser. --- src/main/java/net/pterodactylus/sone/text/SoneTextParser.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) { -- 2.7.4