mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
make external links open in a new tab
This commit is contained in:
@@ -8,6 +8,8 @@ import javax.ejb.Stateless;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
||||
import com.commafeed.model.Feed;
|
||||
import com.commafeed.model.FeedEntry;
|
||||
@@ -65,6 +67,13 @@ public class FeedParser {
|
||||
}
|
||||
}), SystemUtils.LINE_SEPARATOR);
|
||||
}
|
||||
content = handleContent(content);
|
||||
return content;
|
||||
}
|
||||
|
||||
private String handleContent(String content) {
|
||||
Document doc = Jsoup.parse(content);
|
||||
doc.select("a").attr("target", "_blank");
|
||||
return doc.outerHtml();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||
|
||||
import com.commafeed.backend.dao.FeedCategoryService;
|
||||
@@ -78,7 +79,7 @@ public class FeedEntriesREST extends JSONPage {
|
||||
|
||||
@Override
|
||||
public int compare(Entry e1, Entry e2) {
|
||||
return e2.getDate().compareTo(e1.getDate());
|
||||
return ObjectUtils.compare(e2.getDate(), e1.getDate());
|
||||
}
|
||||
});
|
||||
return entries;
|
||||
|
||||
Reference in New Issue
Block a user