X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;h=6752c12b45c7a9209386accf9b89a60756774713;hp=b675c121e3caef74f0ccdc35ac4c496489213a54;hb=2241b13275a0dec86461aba67db92825424b9f1b;hpb=505c771415cd5c6f71c24e6c2b837d6e2f0c3a78 diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index b675c12..6752c12 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 == '.'; + } + private static class NextLink { private final int position;