X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;h=dbfa0f3188838fb52389cf85ec8033d5d1fbc4eb;hb=15f4c53dd87e07b452a04ec2d0e022197e09bd92;hp=b675c121e3caef74f0ccdc35ac4c496489213a54;hpb=505c771415cd5c6f71c24e6c2b837d6e2f0c3a78;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index b675c12..dbfa0f3 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -296,6 +296,13 @@ public class SoneTextParser implements Parser { return line.length(); } int nextWhitespace = matcher.start(); + int lastPunctuation = nextWhitespace; + while (isPunctuation(line.charAt(lastPunctuation - 1))) { + lastPunctuation -= 1; + } + if (lastPunctuation < nextWhitespace) { + return lastPunctuation; + } int openParens = 0; for (int i = 0; i < nextWhitespace; i++) { switch (line.charAt(i)) { @@ -313,6 +320,10 @@ public class SoneTextParser implements Parser { return nextWhitespace; } + private boolean isPunctuation(char character) { + return (character == '.') || (character == ','); + } + private static class NextLink { private final int position;