com.atlassian.renderer.v2
Class RenderMode

java.lang.Object
  extended by com.atlassian.renderer.v2.RenderMode

public class RenderMode
extends Object

Describes which operations are permitted at any point in the rendering of a page from wiki to HTML.

Essentially, this is a big collection of bitwise flags. If we need more than 64 flags we'll have to switch to using the java.util.BitSet, but for now, clients get cleaner-looking code just using the flag constants.


Field Summary
static RenderMode ALL
          Render everything
static RenderMode ALL_WITH_NO_MACRO_ERRORS
          Render mode for suppressing the warning messages for unfound macros
static RenderMode COMPATIBILITY_MODE
           
static long F_ALL
          Render everything
static long F_BACKSLASH_ESCAPE
          Escape special characters preceded by a backslash
static long F_FIRST_PARA
          Render a paragraph even if it is the first line of a block of content.
static long F_HTMLESCAPE
          Escape characters that might be confused with HTML
static long F_IMAGES
          Render explicit images
static long F_LINEBREAKS
          Render newlines and forced linebreaks
static long F_LINKS
          Render [links], free URLs and (if enabled) CamelCaseLinks
static long F_LISTS
          Render lists
static long F_MACROS
          Render macros
static long F_MACROS_ERR_MSG
          Render an error message when a macro is not found
static long F_NONE
          Render nothing
static long F_PARAGRAPHS
          Render paragraph (you might also need F_FIRST_PARA
static long F_PHRASES
          Render phrase markup - bold, italic etc.
static long F_PRESERVE_ENTITIES
          Preserve HTML entities (i.e. don't escape the & in Ӓ) -- only meaningful when F_HTMLESCAPE is set
static long F_RESOLVE_TOKENS
          Resolve tokens
static long F_TABLES
          Render tables
static long F_TEMPLATE
          Template variables
static RenderMode INLINE
          Render things you'd normally find inside a paragraph
static RenderMode LINKS_ONLY
          Render only links (usually for link extraction)
static RenderMode LIST_ITEM
          Render mode for contents of a list item
static RenderMode MACROS_ONLY
          Render mode for macros only
static RenderMode NO_ESCAPE
          Render everything, but assume HTML escaping has already occurred
static RenderMode NO_RENDER
          Don't render anything
static RenderMode PHRASES_IMAGES
          Render phrases and images
static RenderMode PHRASES_LINKS
          Render phrases and links
static RenderMode SIMPLE_TEXT
          Render text made up only of paragraphs, without images or links
static RenderMode TABLE_CELL
          Render mode for contents of a table cell (links in a table are rendered before cell division to avoid pipe conflicts...)
 
Method Summary
static RenderMode allow(long flags)
          Create a new render mode by starting from the state where nothing is permitted, then turning on those flags passed into the method.
 RenderMode and(RenderMode otherMode)
          Create a new render mode that is the logical AND of this and another render mode.
 boolean backslashEscape()
           
 boolean equals(Object o)
           
 int hashCode()
           
 boolean htmlEscape()
           
 RenderMode or(RenderMode otherMode)
          Create a new render mode that is the logical OR of this and another render mode.
 boolean preserveEntities()
           
 boolean renderFirstParagraph()
           
 boolean renderImages()
           
 boolean renderLinebreaks()
           
 boolean renderLinks()
           
 boolean renderLists()
           
 boolean renderMacroErrorMessages()
           
 boolean renderMacros()
           
 boolean renderNothing()
           
 boolean renderParagraphs()
           
 boolean renderPhrases()
           
 boolean renderTables()
           
 boolean renderTemplate()
           
 boolean resolveTokens()
           
static RenderMode suppress(long flags)
          Create a new render mode by starting from the state where everything is permitted, and then switching off those flags passed into the method.
 boolean tokenizes()
          Whether or not this current render mode will create tokens that need to be detokenized.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

F_ALL

public static final long F_ALL
Render everything

See Also:
Constant Field Values

F_NONE

public static final long F_NONE
Render nothing

See Also:
Constant Field Values

F_PARAGRAPHS

public static final long F_PARAGRAPHS
Render paragraph (you might also need F_FIRST_PARA

See Also:
Constant Field Values

F_LINEBREAKS

public static final long F_LINEBREAKS
Render newlines and forced linebreaks

See Also:
Constant Field Values

F_MACROS

public static final long F_MACROS
Render macros

See Also:
Constant Field Values

F_LINKS

public static final long F_LINKS
Render [links], free URLs and (if enabled) CamelCaseLinks

See Also:
Constant Field Values

F_PHRASES

public static final long F_PHRASES
Render phrase markup - bold, italic etc. as well as typographical markup and emoticons

See Also:
Constant Field Values

F_IMAGES

public static final long F_IMAGES
Render explicit images

See Also:
Constant Field Values

F_TABLES

public static final long F_TABLES
Render tables

See Also:
Constant Field Values

F_HTMLESCAPE

public static final long F_HTMLESCAPE
Escape characters that might be confused with HTML

See Also:
Constant Field Values

F_FIRST_PARA

public static final long F_FIRST_PARA

Render a paragraph even if it is the first line of a block of content. (requires F_PARAGRAPHS). Suppress this flag if you wish *not* to encapsulate the first paragraph in p tags.

Some Macros, such as the info macro, want to be more streamlined if they only contain one paragraph, and since they are already in a div, the p tag is not really required. Such macros suppress this flag.

See Also:
Constant Field Values

F_LISTS

public static final long F_LISTS
Render lists

See Also:
Constant Field Values

F_RESOLVE_TOKENS

public static final long F_RESOLVE_TOKENS
Resolve tokens

See Also:
Constant Field Values

F_PRESERVE_ENTITIES

public static final long F_PRESERVE_ENTITIES
Preserve HTML entities (i.e. don't escape the & in Ӓ) -- only meaningful when F_HTMLESCAPE is set

See Also:
Constant Field Values

F_BACKSLASH_ESCAPE

public static final long F_BACKSLASH_ESCAPE
Escape special characters preceded by a backslash

See Also:
Constant Field Values

F_TEMPLATE

public static final long F_TEMPLATE
Template variables

See Also:
Constant Field Values

F_MACROS_ERR_MSG

public static final long F_MACROS_ERR_MSG
Render an error message when a macro is not found

See Also:
Constant Field Values

ALL

public static final RenderMode ALL
Render everything


NO_ESCAPE

public static final RenderMode NO_ESCAPE
Render everything, but assume HTML escaping has already occurred


LINKS_ONLY

public static final RenderMode LINKS_ONLY
Render only links (usually for link extraction)


INLINE

public static final RenderMode INLINE
Render things you'd normally find inside a paragraph


PHRASES_IMAGES

public static final RenderMode PHRASES_IMAGES
Render phrases and images


PHRASES_LINKS

public static final RenderMode PHRASES_LINKS
Render phrases and links


SIMPLE_TEXT

public static final RenderMode SIMPLE_TEXT
Render text made up only of paragraphs, without images or links


LIST_ITEM

public static final RenderMode LIST_ITEM
Render mode for contents of a list item


TABLE_CELL

public static final RenderMode TABLE_CELL
Render mode for contents of a table cell (links in a table are rendered before cell division to avoid pipe conflicts...)


ALL_WITH_NO_MACRO_ERRORS

public static final RenderMode ALL_WITH_NO_MACRO_ERRORS
Render mode for suppressing the warning messages for unfound macros


MACROS_ONLY

public static final RenderMode MACROS_ONLY
Render mode for macros only


NO_RENDER

public static final RenderMode NO_RENDER
Don't render anything


COMPATIBILITY_MODE

public static final RenderMode COMPATIBILITY_MODE
Method Detail

suppress

public static RenderMode suppress(long flags)
Create a new render mode by starting from the state where everything is permitted, and then switching off those flags passed into the method. So, for example, if you want a mode where everything is allowed EXCEPT macros and links, you would use: RenderMode.suppress(F_MACROS | F_LINKS};.

Parameters:
flags - a bitmask of the flags that are NOT set in this render mode
Returns:
the appropriate render mode with 'flags' turned off
See Also:
allow(long)

allow

public static RenderMode allow(long flags)
Create a new render mode by starting from the state where nothing is permitted, then turning on those flags passed into the method. So, for example, if you want a mode where ONLY paragraphs and linebreaks are rendered, you would use: RenderMode.allow(F_PARAGRAPHS | F_LINEBREAKS);.

Parameters:
flags - a bitmask of the flags that are set in this render mode.
Returns:
the appropriate render mode with 'flags' turned on
See Also:
suppress(long)

and

public RenderMode and(RenderMode otherMode)
Create a new render mode that is the logical AND of this and another render mode. This is useful for a case in which you need to render with certain flags set UNLESS they're already forbidden by a previous mode.


or

public RenderMode or(RenderMode otherMode)
Create a new render mode that is the logical OR of this and another render mode. This is useful for a case in which you need to render with certain flags set IN ADDITION TO a previous mode.


renderLinebreaks

public boolean renderLinebreaks()

renderLinks

public boolean renderLinks()

renderMacros

public boolean renderMacros()

renderParagraphs

public boolean renderParagraphs()

renderPhrases

public boolean renderPhrases()

renderImages

public boolean renderImages()

renderTables

public boolean renderTables()

renderNothing

public boolean renderNothing()

htmlEscape

public boolean htmlEscape()

backslashEscape

public boolean backslashEscape()

renderFirstParagraph

public boolean renderFirstParagraph()

renderTemplate

public boolean renderTemplate()

renderLists

public boolean renderLists()

resolveTokens

public boolean resolveTokens()

renderMacroErrorMessages

public boolean renderMacroErrorMessages()

preserveEntities

public boolean preserveEntities()

tokenizes

public boolean tokenizes()
Whether or not this current render mode will create tokens that need to be detokenized.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.