Index: src/main/java/com/xpn/xwiki/plugin/feed/FeedPlugin.java =================================================================== --- src/main/java/com/xpn/xwiki/plugin/feed/FeedPlugin.java (revision 28503) +++ src/main/java/com/xpn/xwiki/plugin/feed/FeedPlugin.java (working copy) @@ -40,6 +40,7 @@ import org.xwiki.cache.CacheException; import org.xwiki.cache.config.CacheConfiguration; import org.xwiki.cache.eviction.LRUEvictionConfiguration; +import org.xwiki.rendering.syntax.Syntax; import com.sun.syndication.feed.synd.SyndCategory; import com.sun.syndication.feed.synd.SyndContent; @@ -491,9 +492,8 @@ context.getWiki().getDocument( prefix + "_" + context.getWiki().clearName(feedname, true, true, context), context); objs = doc.getObjects("XWiki.FeedEntryClass"); - if ((doc.getContent() == null) || doc.getContent().trim().equals("")) { - doc.setContent("#includeForm(\"XWiki.FeedEntryClassSheet\")"); - doc.setSyntaxId(XWikiDocument.XWIKI10_SYNTAXID); + if (!StringUtils.isBlank(doc.getContent())) { + this.prepareFeedEntryDocument(doc, context); } } @@ -514,9 +514,8 @@ // Set the creation date to the feed date if it exists, otherwise the current date Date adate = (entry.getPublishedDate() == null) ? new Date() : entry.getPublishedDate(); doc.setCreationDate(adate); - if ((doc.getContent() == null) || doc.getContent().trim().equals("")) { - doc.setContent("#includeForm(\"XWiki.FeedEntryClassSheet\")"); - doc.setSyntaxId(XWikiDocument.XWIKI10_SYNTAXID); + if (!StringUtils.isBlank(doc.getContent())) { + this.prepareFeedEntryDocument(doc, context); } if (force) { BaseObject obj = doc.getObject("XWiki.FeedEntryClass"); @@ -550,6 +549,30 @@ return nbtotal; } + /** + * Prepares a feed entry document by setting its content and syntax according to the configuration. + * + * @param document the document to prepare as a feed entry document + * @param context the XWiki context when preparing the feed entry document + */ + private void prepareFeedEntryDocument(XWikiDocument document, XWikiContext context) + { + if (StringUtils.isBlank( context.getWiki().Param("xwiki.plugins.feed.entryContent") )) { + document.setContent("{{include document=\"XWiki.FeedEntryClassSheet\" /}"); + } + else { + document.setContent(context.getWiki().Param("xwiki.plugins.feed.entryContent")); + } + if (StringUtils.isBlank( context.getWiki().Param("xwiki.plugins.feed.entrySyntaxId") )) { + document.setSyntax(Syntax.XWIKI_2_0); + } + else { + // Let the document try to create the Syntax object from the ID string retrieved from the configuration + // It fails, it will fallback on the document default Syntax ID (which is a XWiki core configuration entry). + document.setSyntaxId(context.getWiki().Param("xwiki.plugins.feed.entrySyntaxId")); + } + } + public BaseClass getAggregatorURLClass(XWikiContext context) throws XWikiException { XWikiDocument doc;