public class WeblogPlugin extends Object implements WikiPlugin, ParserStagePlugin
Builds a simple weblog. The pageformat can use the following params:
%p - Page name
Parameters:
The "days" and "startDate" can also be sent in HTTP parameters, and the names are "weblog.days" and "weblog.startDate", respectively.
The weblog plugin also adds an attribute to each page it is on: "weblogplugin.isweblog" is set to "true". This can be used to quickly peruse pages which have weblogs.
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_ISWEBLOG
The attribute which is stashed to the WikiPage attributes to check if a page
is a weblog or not.
|
static String |
DEFAULT_DATEFORMAT
The default date format used in the blog entry page names.
|
static String |
PARAM_ALLOWCOMMENTS
Parameter name for the allowComments.
|
static String |
PARAM_DAYS
Parameter name for the days.
|
static String |
PARAM_ENTRYFORMAT
Parameter name for the entryFormat.
|
static String |
PARAM_MAXENTRIES
Parameter name for the maxEntries.
|
static String |
PARAM_PAGE
Parameter name for the page.
|
static String |
PARAM_PREVIEW
Parameter name for the preview.
|
static String |
PARAM_STARTDATE
Parameter name for the startDate.
|
CORE_PLUGINS_RESOURCEBUNDLE
Constructor and Description |
---|
WeblogPlugin() |
Modifier and Type | Method and Description |
---|---|
String |
execute(WikiContext context,
Map<String,String> params)
This is the main entry point for any plugin.
|
void |
executeParser(PluginContent element,
WikiContext context,
Map<String,String> params)
Mark us as being a real weblog.
|
List<WikiPage> |
findBlogEntries(WikiEngine engine,
String baseName,
Date start,
Date end)
Attempts to locate all pages that correspond to the
blog entry pattern.
|
static String |
makeEntryPage(String pageName)
Return just the basename for entires without date and entry numebr.
|
static String |
makeEntryPage(String pageName,
String date)
Returns the entry page without the entry number.
|
static String |
makeEntryPage(String pageName,
String date,
String entryNum)
Create an entry name based on the blogname, a date, and an entry number.
|
public static final String DEFAULT_DATEFORMAT
public static final String PARAM_STARTDATE
public static final String PARAM_ENTRYFORMAT
public static final String PARAM_DAYS
public static final String PARAM_ALLOWCOMMENTS
public static final String PARAM_MAXENTRIES
public static final String PARAM_PAGE
public static final String PARAM_PREVIEW
public static final String ATTR_ISWEBLOG
public WeblogPlugin()
public static String makeEntryPage(String pageName, String date, String entryNum)
pageName
- Name of the blogdate
- The date (in ddMMyy format)entryNum
- The entry number.public static String makeEntryPage(String pageName)
pageName
- The name of the blog.public static String makeEntryPage(String pageName, String date)
pageName
- Blog name.date
- The date.public String execute(WikiContext context, Map<String,String> params) throws PluginException
Note that it is preferred that the plugin returns XHTML-compliant HTML (i.e. close all tags, use <br /> instead of <br>, etc.
execute
in interface WikiPlugin
context
- The current WikiContext.params
- A Map which contains key-value pairs. Any
parameter that the user has specified on the
wiki page will contain String-String
parameters, but it is possible that at some future date,
JSPWiki will give you other things that are not Strings.PluginException
- In case anything goes wrong.public List<WikiPage> findBlogEntries(WikiEngine engine, String baseName, Date start, Date end) throws ProviderException
engine
- WikiEngine which is used to get the pagesbaseName
- The basename (e.g. "Main" if you want "Main_blogentry_xxxx")start
- The date which is the first to be consideredend
- The end date which is the last to be consideredProviderException
- If something goes wrongpublic void executeParser(PluginContent element, WikiContext context, Map<String,String> params)
executeParser
in interface ParserStagePlugin
element
- The JDOM element which has already been connected to the Document.context
- WikiContext, as usual.params
- Parsed parameters for the plugin.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.