activity.content = replaceMentions(activity.content);
}
}
protected static String replaceMentions(String content) {
Jerry doc = jerry(content);
doc.$("a").each(new JerryFunction() {
public boolean onNode(Jerry linkHtml, int i) {
final String link = linkHtml.attr("href");
Matcher matcher = PROFILE_URL.matcher(link);
if (matcher.matches()) {
final String mentionedId = matcher.group(1);
final Jerry mentionHtml = linkHtml.parent();
mentionHtml.html(mention(mentionedId, mentionHtml.html()));
}
return true;
}
});
return doc.html();