projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix parser.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
text
/
SoneTextParser.java
diff --git
a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java
b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java
index
9754ac4
..
0c20abe
100644
(file)
--- 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<SoneTextParserContext> {
}
if (linkType == LinkType.SONE) {
if (next > 0) {
}
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);
}
if (line.length() >= (next + 7 + 43)) {
String soneId = line.substring(next + 7, next + 50);
@@
-192,6
+196,7
@@
public class SoneTextParser implements Parser<SoneTextParserContext> {
parts.add(new PlainTextPart(line.substring(next)));
line = "";
}
parts.add(new PlainTextPart(line.substring(next)));
line = "";
}
+ lineComplete = false;
continue;
}
if (linkType == LinkType.POST) {
continue;
}
if (linkType == LinkType.POST) {
@@
-202,8
+207,6
@@
public class SoneTextParser implements Parser<SoneTextParserContext> {
String postId = line.substring(next + 7, next + 43);
Post post = postProvider.getPost(postId, false);
if ((post != null) && (post.getSone() != null)) {
String postId = line.substring(next + 7, next + 43);
Post post = postProvider.getPost(postId, false);
if ((post != null) && (post.getSone() != null)) {
- String postText = post.getText();
- postText = postText.substring(0, Math.min(postText.length(), 20)) + "…";
parts.add(new PostPart(post));
} else {
parts.add(new PlainTextPart(line.substring(next, next + 43)));
parts.add(new PostPart(post));
} else {
parts.add(new PlainTextPart(line.substring(next, next + 43)));