Package org.apache.wiki.render
Interface RenderingManager
-
- All Superinterfaces:
java.util.EventListener
,Initializable
,InternalModule
,RenderApi
,WikiEventListener
- All Known Implementing Classes:
DefaultRenderingManager
public interface RenderingManager extends RenderApi, WikiEventListener, InternalModule, Initializable
This class provides a facade towards the differing rendering routines. You should use the routines in this manager instead of the ones in Engine, if you don't want the different side effects to occur - such as WikiFilters.This class also manages a rendering cache, i.e. documents are stored between calls. You may control the cache by tweaking the ehcache-jspwiki.xml file.
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROP_BEAUTIFYTITLE
static java.lang.String
PROP_PARSER
markup parser property.static java.lang.String
PROP_RENDERER
default renderer property.static java.lang.String
PROP_WYSIWYG_RENDERER
default wysiwyg renderer property.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String
beautifyTitle(java.lang.String title)
Beautifies the title of the page by appending spaces in suitable places, if the user has so decreed in the properties when constructing this Engine.java.lang.String
beautifyTitleNoBreak(java.lang.String title)
Beautifies the title of the page by appending non-breaking spaces in suitable places.default java.lang.String
getHTML(java.lang.String page)
Returns the converted HTML of the page.java.lang.String
getHTML(java.lang.String pagename, int version)
Returns the converted HTML of the page's specific version.default java.lang.String
getHTML(Context context, java.lang.String pagedata)
Convenience method for rendering, using the default parser and renderer.java.lang.String
getHTML(Context context, Page page)
Returns the converted HTML of the page using a different context than the default context.java.lang.String
getHTML(Context context, WikiDocument doc)
Simply renders a WikiDocument to a String.MarkupParser
getParser(Context context, java.lang.String pagedata)
Returns the wiki ParserWikiDocument
getRenderedDocument(Context context, java.lang.String pagedata)
Returns a cached document, if one is found.WikiRenderer
getRenderer(Context context, WikiDocument doc)
Returns a WikiRenderer instance, initialized with the given context and doc.WikiRenderer
getWysiwygRenderer(Context context, WikiDocument doc)
Returns a WikiRenderer instance meant for WYSIWYG editing, initialized with the given context and doc.default java.lang.String
textToHTML(Context context, java.lang.String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook)
Just convert WikiText to HTML.default java.lang.String
textToHTML(Context context, java.lang.String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook, StringTransmutator attLinkHook)
Just convert WikiText to HTML.java.lang.String
textToHTML(Context context, java.lang.String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook, StringTransmutator attLinkHook, boolean parseAccessRules, boolean justParse)
Helper method for doing the HTML translation.-
Methods inherited from interface org.apache.wiki.api.engine.Initializable
initialize
-
Methods inherited from interface org.apache.wiki.api.engine.RenderApi
textToHTML
-
Methods inherited from interface org.apache.wiki.event.WikiEventListener
actionPerformed
-
-
-
-
Field Detail
-
PROP_PARSER
static final java.lang.String PROP_PARSER
markup parser property.- See Also:
- Constant Field Values
-
PROP_RENDERER
static final java.lang.String PROP_RENDERER
default renderer property.- See Also:
- Constant Field Values
-
PROP_WYSIWYG_RENDERER
static final java.lang.String PROP_WYSIWYG_RENDERER
default wysiwyg renderer property.- See Also:
- Constant Field Values
-
PROP_BEAUTIFYTITLE
static final java.lang.String PROP_BEAUTIFYTITLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
beautifyTitle
java.lang.String beautifyTitle(java.lang.String title)
Beautifies the title of the page by appending spaces in suitable places, if the user has so decreed in the properties when constructing this Engine. However, attachment names are only beautified by the name.- Parameters:
title
- The title to beautify- Returns:
- A beautified title (or, if beautification is off, returns the title without modification)
- Since:
- 1.7.11, moved to PageManager on 2.11.0
-
beautifyTitleNoBreak
java.lang.String beautifyTitleNoBreak(java.lang.String title)
Beautifies the title of the page by appending non-breaking spaces in suitable places. This is really suitable only for HTML output, as it uses the -character.- Parameters:
title
- The title to beautify- Returns:
- A beautified title.
- Since:
- 2.1.127
-
getParser
MarkupParser getParser(Context context, java.lang.String pagedata)
Returns the wiki Parser- Parameters:
pagedata
- the page data- Returns:
- A MarkupParser instance.
-
getRenderedDocument
WikiDocument getRenderedDocument(Context context, java.lang.String pagedata)
Returns a cached document, if one is found.- Parameters:
context
- the wiki contextpagedata
- the page data- Returns:
- the rendered wiki document
-
getRenderer
WikiRenderer getRenderer(Context context, WikiDocument doc)
Returns a WikiRenderer instance, initialized with the given context and doc. The object is an XHTMLRenderer, unless overridden in jspwiki.properties with PROP_RENDERER.- Parameters:
context
- The WikiContextdoc
- The document to render- Returns:
- A WikiRenderer for this document, or null, if no such renderer could be instantiated.
-
getWysiwygRenderer
WikiRenderer getWysiwygRenderer(Context context, WikiDocument doc)
Returns a WikiRenderer instance meant for WYSIWYG editing, initialized with the given context and doc. The object is an WysiwygEditingRenderer, unless overridden in jspwiki.properties with PROP_WYSIWYG_RENDERER.- Parameters:
context
- The WikiContextdoc
- The document to render- Returns:
- A WikiRenderer instance meant for WYSIWYG editing, for this document, or null, if no such renderer could be instantiated.
-
getHTML
java.lang.String getHTML(Context context, WikiDocument doc) throws java.io.IOException
Simply renders a WikiDocument to a String. This version does not get the document from the cache - in fact, it does not cache the document at all. This is very useful, if you have something that you want to render outside the caching routines. Because the cache is based on full pages, and the cache keys are based on names, use this routine if you're rendering anything for yourself.- Parameters:
context
- The WikiContext to render indoc
- A proper WikiDocument- Returns:
- Rendered HTML.
- Throws:
java.io.IOException
- If the WikiDocument is poorly formed.
-
getHTML
java.lang.String getHTML(Context context, Page page)
Returns the converted HTML of the page using a different context than the default context.- Parameters:
context
- A WikiContext in which you wish to render this page in.page
- WikiPage reference.- Returns:
- HTML-rendered version of the page.
-
getHTML
java.lang.String getHTML(java.lang.String pagename, int version)
Returns the converted HTML of the page's specific version. The version must be a positive integer, otherwise the current version is returned.- Parameters:
pagename
- WikiName of the page to convert.version
- Version number to fetch- Returns:
- HTML-rendered page text.
-
getHTML
default java.lang.String getHTML(Context context, java.lang.String pagedata)
Convenience method for rendering, using the default parser and renderer. Note that you can't use this method to do any arbitrary rendering, as the pagedata MUST be the data from the that the WikiContext refers to - this method caches the HTML internally, and will return the cached version. If the pagedata is different from what was cached, will re-render and store the pagedata into the internal cache.- Parameters:
context
- the wiki contextpagedata
- the page data- Returns:
- XHTML data.
-
getHTML
default java.lang.String getHTML(java.lang.String page)
Returns the converted HTML of the page.- Parameters:
page
- WikiName of the page to convert.- Returns:
- HTML-rendered version of the page.
-
textToHTML
java.lang.String textToHTML(Context context, java.lang.String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook, StringTransmutator attLinkHook, boolean parseAccessRules, boolean justParse)
Helper method for doing the HTML translation.- Parameters:
context
- The WikiContext in which to do the conversionpagedata
- The data to renderlocalLinkHook
- Is called whenever a wiki link is foundextLinkHook
- Is called whenever an external link is foundparseAccessRules
- Parse the access rules if we encounter themjustParse
- Just parses the pagedata, does not actually render. In this case, this methods an empty string.- Returns:
- HTML-rendered page text.
-
textToHTML
default java.lang.String textToHTML(Context context, java.lang.String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook)
Just convert WikiText to HTML.- Parameters:
context
- The WikiContext in which to do the conversionpagedata
- The data to renderlocalLinkHook
- Is called whenever a wiki link is foundextLinkHook
- Is called whenever an external link is found- Returns:
- HTML-rendered page text.
-
textToHTML
default java.lang.String textToHTML(Context context, java.lang.String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook, StringTransmutator attLinkHook)
Just convert WikiText to HTML.- Parameters:
context
- The WikiContext in which to do the conversionpagedata
- The data to renderlocalLinkHook
- Is called whenever a wiki link is foundextLinkHook
- Is called whenever an external link is foundattLinkHook
- Is called whenever an attachment link is found- Returns:
- HTML-rendered page text.
-
-