Class WeblogPlugin

java.lang.Object
org.apache.wiki.plugin.WeblogPlugin
All Implemented Interfaces:
org.apache.wiki.api.plugin.ParserStagePlugin, org.apache.wiki.api.plugin.Plugin

public class WeblogPlugin extends Object implements org.apache.wiki.api.plugin.Plugin, org.apache.wiki.api.plugin.ParserStagePlugin

Builds a simple weblog. The pageformat can use the following params:

%p - Page name

Parameters:

  • page - which page is used to do the blog; default is the current page.
  • entryFormat - how to display the date on pages, using the J2SE SimpleDateFormat syntax. Defaults to the current locale's DateFormat.LONG format for the date, and current locale's DateFormat.SHORT for the time. Thus, for the US locale this will print dates similar to this: September 4, 2005 11:54 PM
  • days - how many days the weblog aggregator should show. If set to "all", shows all pages.
  • pageformat - What the entry pages should look like.
  • startDate - Date when to start. Format is "ddMMyy."
  • maxEntries - How many entries to show at most.
  • preview - How many characters of the text to show on the preview page.

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.

Since:
1.9.21
  • Field Details

  • Constructor Details

  • Method Details

    • makeEntryPage

      public static String makeEntryPage(String pageName, String date, String entryNum)
      Create an entry name based on the blogname, a date, and an entry number.
      Parameters:
      pageName - Name of the blog
      date - The date (in ddMMyy format)
      entryNum - The entry number.
      Returns:
      A formatted page name.
    • makeEntryPage

      public static String makeEntryPage(String pageName)
      Return just the basename for entires without date and entry numebr.
      Parameters:
      pageName - The name of the blog.
      Returns:
      A formatted name.
    • makeEntryPage

      public static String makeEntryPage(String pageName, String date)
      Returns the entry page without the entry number.
      Parameters:
      pageName - Blog name.
      date - The date.
      Returns:
      A base name for the blog entries.
    • getDisplayName

      public String getDisplayName(Locale locale)
      Specified by:
      getDisplayName in interface org.apache.wiki.api.plugin.Plugin
    • getSnipExample

      Specified by:
      getSnipExample in interface org.apache.wiki.api.plugin.Plugin
    • execute

      public String execute(org.apache.wiki.api.core.Context context, Map<String,String> params) throws org.apache.wiki.api.exceptions.PluginException
      Specified by:
      execute in interface org.apache.wiki.api.plugin.Plugin
      Throws:
      org.apache.wiki.api.exceptions.PluginException
    • findBlogEntries

      public List<org.apache.wiki.api.core.Page> findBlogEntries(org.apache.wiki.api.core.Engine engine, String baseName, Date start, Date end)
      Attempts to locate all pages that correspond to the blog entry pattern. Will only consider the days on the dates; not the hours and minutes.
      Parameters:
      engine - Engine which is used to get the pages
      baseName - The basename (e.g. "Main" if you want "Main_blogentry_xxxx")
      start - The date which is the first to be considered
      end - The end date which is the last to be considered
      Returns:
      a list of pages with their FIRST revisions.
    • executeParser

      public void executeParser(org.apache.wiki.api.plugin.PluginElement element, org.apache.wiki.api.core.Context context, Map<String,String> params)
      Mark us as being a real weblog.
      Specified by:
      executeParser in interface org.apache.wiki.api.plugin.ParserStagePlugin