Permalink
Browse files

New HTML fixes from Fuuka.

  • Loading branch information...
1 parent 4e28177 commit bfe9bd46c185eb066553da6413824878104a1a74 @eksopl committed May 13, 2012
@@ -332,9 +332,6 @@ public void run() {
// Comment too long. Click here to view the full text.
// This means we have to refresh the full thread
if(newPost.isOmitted()) mustRefresh = true;
-
- // We have to refresh to get the image filename, sadly
- if(newPost.getMedia() != null) mustRefresh = true;
}
// Update the time we last hit this thread
@@ -31,6 +31,7 @@
private static final Pattern commentPattern;
private static final Pattern stickyPattern;
private static final Pattern omittedPattern;
+ private static final Pattern oldCapPattern;
private static final Pattern omPostsPattern;
private static final Pattern omImagesPattern;
@@ -65,6 +66,7 @@
String commentPatString = "<blockquote \\s class=\"postMessage\" [^>]*>(.*?)</blockquote>";
String stickyPatString = "<img [^>]* \\s* alt=\"Sticky\" \\s* title=\"Sticky\" \\s */>";
String omittedPatString = "<span \\s class=\"abbr\">Comment \\s too \\s long";
+ String oldCapPatString = "<span \\s class=\"commentpostername\"><span [^>]*>\\#\\# \\s (.)[^<]*</span></span>";
String omPostsPatString = "<span \\s class=\"info\">\\s*<strong>([0-9]*) \\s posts \\s omitted";
String omImagesPatString = "<em>\\(([0-9]*) \\s have \\s images\\)</em>";
@@ -75,6 +77,8 @@
commentPattern = Pattern.compile(commentPatString, Pattern.COMMENTS | Pattern.DOTALL);
stickyPattern = Pattern.compile(stickyPatString, Pattern.COMMENTS | Pattern.DOTALL);
omittedPattern = Pattern.compile(omittedPatString, Pattern.COMMENTS | Pattern.DOTALL);
+ oldCapPattern = Pattern.compile(oldCapPatString, Pattern.COMMENTS | Pattern.DOTALL);
+
omPostsPattern = Pattern.compile(omPostsPatString, Pattern.COMMENTS | Pattern.DOTALL);
omImagesPattern = Pattern.compile(omImagesPatString, Pattern.COMMENTS | Pattern.DOTALL);
@@ -318,6 +322,11 @@ public Post parsePost(String text, int parent) throws ContentParseException {
((mat.group(5) != null) ? new String(mat.group(5)) : null) :
new String(mat.group(4));
//String uid = mat.group(6);
+
+ mat = oldCapPattern.matcher(text);
+ if(mat.find()) {
+ capcode = (mat.group(1) != null) ? new String(mat.group(1)) : null;
+ }
mat = datePattern.matcher(text);
if(!mat.find()) {
@@ -1,7 +1,7 @@
(?:<a \s href="mailto:([^"]*)" \s class="useremail">)? \s*
-<span \s class="name">([^<]*)</span> \s*
-(?:<span \s class="postertrip">([^<]*)</span>)? \s*
-(?:<strong \s class="capcode">\#\# \s (.)[^<]*</strong>)? \s*
+<span \s class="name">(?:<span [^>]*)?([^<]*)(?:</span>)?</span> \s*
+(?:<span \s class="postertrip">(?:<span [^>]*)?([^<]*)(?:</span>)?</span>)? \s*
+(?:<strong \s class="capcode [^"]*">\#\# \s (.)[^<]*</strong>)? \s*
(?:</a>)? \s*
(?:<span \s class="posteruid">\(ID: \s (?: <span [^>]*>(.)[^)]*
| ([^)]*))\)</span>)?

0 comments on commit bfe9bd4

Please sign in to comment.