Use summary tag if content is not available

This commit is contained in:
Cj Malone 2016-09-23 13:55:43 +01:00
parent 4a1e728ac5
commit 68b7431aac
1 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,7 @@ public class NSAtom extends Namespace {
private static final String AUTHOR = "author"; private static final String AUTHOR = "author";
private static final String AUTHOR_NAME = "name"; private static final String AUTHOR_NAME = "name";
private static final String CONTENT = "content"; private static final String CONTENT = "content";
private static final String SUMMARY = "summary";
private static final String IMAGE_LOGO = "logo"; private static final String IMAGE_LOGO = "logo";
private static final String IMAGE_ICON = "icon"; private static final String IMAGE_ICON = "icon";
private static final String SUBTITLE = "subtitle"; private static final String SUBTITLE = "subtitle";
@ -59,8 +60,8 @@ public class NSAtom extends Namespace {
/** /**
* Regexp to test whether an Element is a Text Element. * Regexp to test whether an Element is a Text Element.
*/ */
private static final String isText = TITLE + "|" + CONTENT + "|" + "|" private static final String isText = TITLE + "|" + CONTENT + "|"
+ SUBTITLE; + SUBTITLE + "|" + SUMMARY;
public static final String isFeed = FEED + "|" + NSRSS20.CHANNEL; public static final String isFeed = FEED + "|" + NSRSS20.CHANNEL;
public static final String isFeedItem = ENTRY + "|" + NSRSS20.ITEM; public static final String isFeedItem = ENTRY + "|" + NSRSS20.ITEM;
@ -191,6 +192,9 @@ public class NSAtom extends Namespace {
} else if (CONTENT.equals(top) && ENTRY.equals(second) && textElement != null && } else if (CONTENT.equals(top) && ENTRY.equals(second) && textElement != null &&
state.getCurrentItem() != null) { state.getCurrentItem() != null) {
state.getCurrentItem().setDescription(textElement.getProcessedContent()); state.getCurrentItem().setDescription(textElement.getProcessedContent());
} else if (SUMMARY.equals(top) && ENTRY.equals(second) && textElement != null &&
state.getCurrentItem() != null && state.getCurrentItem().getDescription() == null) {
state.getCurrentItem().setDescription(textElement.getProcessedContent());
} else if (UPDATED.equals(top) && ENTRY.equals(second) && state.getCurrentItem() != null && } else if (UPDATED.equals(top) && ENTRY.equals(second) && state.getCurrentItem() != null &&
state.getCurrentItem().getPubDate() == null) { state.getCurrentItem().getPubDate() == null) {
state.getCurrentItem().setPubDate(DateUtils.parse(content)); state.getCurrentItem().setPubDate(DateUtils.parse(content));