projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ignore punctuation at end of links
[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
b675c12
..
6752c12
100644
(file)
--- 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<SoneTextParserContext> {
return line.length();
}
int nextWhitespace = matcher.start();
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)) {
int openParens = 0;
for (int i = 0; i < nextWhitespace; i++) {
switch (line.charAt(i)) {
@@
-313,6
+320,10
@@
public class SoneTextParser implements Parser<SoneTextParserContext> {
return nextWhitespace;
}
return nextWhitespace;
}
+ private boolean isPunctuation(char character) {
+ return character == '.';
+ }
+
private static class NextLink {
private final int position;
private static class NextLink {
private final int position;