com.atlassian.renderer.v2.components.block
Class BlockRendererComponent

java.lang.Object
  extended by com.atlassian.renderer.v2.components.block.BlockRendererComponent
All Implemented Interfaces:
RendererComponent

public class BlockRendererComponent
extends Object
implements RendererComponent

RendererComponent to handle block structures such as lists, tables and paragraphs. This component is typically the second component to run, the first being the MacroRendererComponent. The component essentially has two tasks: invoking the various BlockRenderers on the lines of wiki markup, and ensuring anything not dealt with by a BlockRenderer is grouped into paragraphs appropriately.

The component has a configurable list of BlockRenderers. The wiki markup is split up and fed to the BlockRenderers line by line. They are passed the current LineWalker so that they can temporarily wrest control from the BlockRendererComponent and process however many consecutive lines they want. Once a BlockRenderer renders a line, that line will not be passed into any other BlockRenderers. Rather, the previous paragraph will be finished, and the rendered block will be added after it.

Content that does not get rendered by a BlockRenderer has further processing applied. Consecutive chunks of content that contain no block tokens and are not handled by a BlockRenderer are grouped together into a paragraph. They then have p tags wrapped around them. If a line containing block tokens is not handled by any BlockRenderer, then it will be split up around the block tokens. The block tokens will not form part of a paragraph but paragraphs will be made of text between block tokens. Text before the first token will be appended to the previous paragraph. Text after the last token will be used as the start of the next paragraph.


Constructor Summary
BlockRendererComponent(SubRenderer subRenderer, List<BlockRenderer> blockRenderers)
           
 
Method Summary
 String render(String wiki, RenderContext context)
          Render this piece of wiki text.
 void setBlockRenderers(List<BlockRenderer> blockRenderers)
           
 boolean shouldRender(RenderMode renderMode)
          Whether or not this render component is required given the current render mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockRendererComponent

public BlockRendererComponent(SubRenderer subRenderer,
                              List<BlockRenderer> blockRenderers)
Method Detail

setBlockRenderers

public void setBlockRenderers(List<BlockRenderer> blockRenderers)

shouldRender

public boolean shouldRender(RenderMode renderMode)
Description copied from interface: RendererComponent
Whether or not this render component is required given the current render mode.

Specified by:
shouldRender in interface RendererComponent

render

public String render(String wiki,
                     RenderContext context)
Description copied from interface: RendererComponent
Render this piece of wiki text.

Specified by:
render in interface RendererComponent


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.