Class WikiSerializerHandler

java.lang.Object
org.wikimodel.wem.PrintTextListener
org.wikimodel.wem.PrintInlineListener
org.wikimodel.wem.PrintListener
org.nuxeo.ecm.platform.rendering.wiki.WikiSerializerHandler
All Implemented Interfaces:
org.wikimodel.wem.IWemListener

public class WikiSerializerHandler extends org.wikimodel.wem.PrintListener
Author:
Bogdan Stefanescu
  • Field Details

    • LINE_SEP

      protected static final String LINE_SEP
    • engine

      protected final WikiSerializer engine
    • words

      protected final StringBuilder words
    • env

      protected freemarker.core.Environment env
    • writer

      protected WikiWriter writer
    • mark

      protected int mark
    • toc

      protected Toc toc
  • Constructor Details

    • WikiSerializerHandler

      public WikiSerializerHandler(WikiSerializer engine)
  • Method Details

    • print

      protected void print(String str)
      Overrides:
      print in class org.wikimodel.wem.PrintTextListener
    • println

      protected void println()
      Overrides:
      println in class org.wikimodel.wem.PrintTextListener
    • println

      protected void println(String str)
      Overrides:
      println in class org.wikimodel.wem.PrintTextListener
    • getWriter

      public WikiWriter getWriter()
    • getEnvironment

      public freemarker.core.Environment getEnvironment()
    • beginElement

      protected void beginElement()
    • endElement

      protected void endElement()
    • flushWords

      protected void flushWords()
    • beginDefinitionDescription

      public void beginDefinitionDescription()
      Specified by:
      beginDefinitionDescription in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginDefinitionDescription in class org.wikimodel.wem.PrintListener
    • beginDefinitionList

      public void beginDefinitionList(org.wikimodel.wem.WikiParameters parameters)
      Specified by:
      beginDefinitionList in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginDefinitionList in class org.wikimodel.wem.PrintListener
    • beginDefinitionTerm

      public void beginDefinitionTerm()
      Specified by:
      beginDefinitionTerm in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginDefinitionTerm in class org.wikimodel.wem.PrintListener
    • beginDocument

      public void beginDocument()
      Specified by:
      beginDocument in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginDocument in class org.wikimodel.wem.PrintListener
    • beginFormat

      public void beginFormat(org.wikimodel.wem.WikiFormat format)
      Specified by:
      beginFormat in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginFormat in class org.wikimodel.wem.PrintInlineListener
    • beginHeader

      public void beginHeader(int level, org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginHeader in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginHeader in class org.wikimodel.wem.PrintListener
    • beginInfoBlock

      public void beginInfoBlock(char infoType, org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginInfoBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginInfoBlock in class org.wikimodel.wem.PrintListener
    • beginList

      public void beginList(org.wikimodel.wem.WikiParameters parameters, boolean ordered)
      Specified by:
      beginList in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginList in class org.wikimodel.wem.PrintListener
    • beginListItem

      public void beginListItem()
      Specified by:
      beginListItem in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginListItem in class org.wikimodel.wem.PrintListener
    • beginParagraph

      public void beginParagraph(org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginParagraph in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginParagraph in class org.wikimodel.wem.PrintListener
    • beginPropertyBlock

      public void beginPropertyBlock(String propertyUri, boolean doc)
      Specified by:
      beginPropertyBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginPropertyBlock in class org.wikimodel.wem.PrintListener
    • beginPropertyInline

      public void beginPropertyInline(String str)
      Specified by:
      beginPropertyInline in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginPropertyInline in class org.wikimodel.wem.PrintInlineListener
    • beginQuotation

      public void beginQuotation(org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginQuotation in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginQuotation in class org.wikimodel.wem.PrintListener
    • beginQuotationLine

      public void beginQuotationLine()
      Specified by:
      beginQuotationLine in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginQuotationLine in class org.wikimodel.wem.PrintListener
    • beginTable

      public void beginTable(org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginTable in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginTable in class org.wikimodel.wem.PrintListener
    • beginTableCell

      public void beginTableCell(boolean tableHead, org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginTableCell in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginTableCell in class org.wikimodel.wem.PrintListener
    • beginTableRow

      public void beginTableRow(org.wikimodel.wem.WikiParameters params)
      Specified by:
      beginTableRow in interface org.wikimodel.wem.IWemListener
      Overrides:
      beginTableRow in class org.wikimodel.wem.PrintListener
    • endDefinitionDescription

      public void endDefinitionDescription()
      Specified by:
      endDefinitionDescription in interface org.wikimodel.wem.IWemListener
      Overrides:
      endDefinitionDescription in class org.wikimodel.wem.PrintListener
    • endDefinitionList

      public void endDefinitionList(org.wikimodel.wem.WikiParameters parameters)
      Specified by:
      endDefinitionList in interface org.wikimodel.wem.IWemListener
      Overrides:
      endDefinitionList in class org.wikimodel.wem.PrintListener
    • endDefinitionTerm

      public void endDefinitionTerm()
      Specified by:
      endDefinitionTerm in interface org.wikimodel.wem.IWemListener
      Overrides:
      endDefinitionTerm in class org.wikimodel.wem.PrintListener
    • endDocument

      public void endDocument()
      Specified by:
      endDocument in interface org.wikimodel.wem.IWemListener
      Overrides:
      endDocument in class org.wikimodel.wem.PrintListener
    • endFormat

      public void endFormat(org.wikimodel.wem.WikiFormat format)
      Specified by:
      endFormat in interface org.wikimodel.wem.IWemListener
      Overrides:
      endFormat in class org.wikimodel.wem.PrintInlineListener
    • endHeader

      public void endHeader(int level, org.wikimodel.wem.WikiParameters params)
      Specified by:
      endHeader in interface org.wikimodel.wem.IWemListener
      Overrides:
      endHeader in class org.wikimodel.wem.PrintListener
    • endInfoBlock

      public void endInfoBlock(char infoType, org.wikimodel.wem.WikiParameters params)
      Specified by:
      endInfoBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      endInfoBlock in class org.wikimodel.wem.PrintListener
    • endList

      public void endList(org.wikimodel.wem.WikiParameters parameters, boolean ordered)
      Specified by:
      endList in interface org.wikimodel.wem.IWemListener
      Overrides:
      endList in class org.wikimodel.wem.PrintListener
    • endListItem

      public void endListItem()
      Specified by:
      endListItem in interface org.wikimodel.wem.IWemListener
      Overrides:
      endListItem in class org.wikimodel.wem.PrintListener
    • endParagraph

      public void endParagraph(org.wikimodel.wem.WikiParameters params)
      Specified by:
      endParagraph in interface org.wikimodel.wem.IWemListener
      Overrides:
      endParagraph in class org.wikimodel.wem.PrintListener
    • endPropertyBlock

      public void endPropertyBlock(String propertyUri, boolean doc)
      Specified by:
      endPropertyBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      endPropertyBlock in class org.wikimodel.wem.PrintListener
    • endPropertyInline

      public void endPropertyInline(String inlineProperty)
      Specified by:
      endPropertyInline in interface org.wikimodel.wem.IWemListener
      Overrides:
      endPropertyInline in class org.wikimodel.wem.PrintInlineListener
    • endQuotation

      public void endQuotation(org.wikimodel.wem.WikiParameters params)
      Specified by:
      endQuotation in interface org.wikimodel.wem.IWemListener
      Overrides:
      endQuotation in class org.wikimodel.wem.PrintListener
    • endQuotationLine

      public void endQuotationLine()
      Specified by:
      endQuotationLine in interface org.wikimodel.wem.IWemListener
      Overrides:
      endQuotationLine in class org.wikimodel.wem.PrintListener
    • endTable

      public void endTable(org.wikimodel.wem.WikiParameters params)
      Specified by:
      endTable in interface org.wikimodel.wem.IWemListener
      Overrides:
      endTable in class org.wikimodel.wem.PrintListener
    • endTableCell

      public void endTableCell(boolean tableHead, org.wikimodel.wem.WikiParameters params)
      Specified by:
      endTableCell in interface org.wikimodel.wem.IWemListener
      Overrides:
      endTableCell in class org.wikimodel.wem.PrintListener
    • endTableRow

      public void endTableRow(org.wikimodel.wem.WikiParameters params)
      Specified by:
      endTableRow in interface org.wikimodel.wem.IWemListener
      Overrides:
      endTableRow in class org.wikimodel.wem.PrintListener
    • onEmptyLines

      public void onEmptyLines(int count)
      Specified by:
      onEmptyLines in interface org.wikimodel.wem.IWemListener
      Overrides:
      onEmptyLines in class org.wikimodel.wem.PrintListener
    • onHorizontalLine

      public void onHorizontalLine()
      Specified by:
      onHorizontalLine in interface org.wikimodel.wem.IWemListener
      Overrides:
      onHorizontalLine in class org.wikimodel.wem.PrintListener
    • onLineBreak

      public void onLineBreak()
      Specified by:
      onLineBreak in interface org.wikimodel.wem.IWemListener
      Overrides:
      onLineBreak in class org.wikimodel.wem.PrintInlineListener
    • onReference

      public void onReference(String ref, boolean explicitLink)
      Specified by:
      onReference in interface org.wikimodel.wem.IWemListener
      Overrides:
      onReference in class org.wikimodel.wem.PrintTextListener
    • onTableCaption

      public void onTableCaption(String str)
      Specified by:
      onTableCaption in interface org.wikimodel.wem.IWemListener
      Overrides:
      onTableCaption in class org.wikimodel.wem.PrintListener
    • onVerbatimBlock

      public void onVerbatimBlock(String str)
      Specified by:
      onVerbatimBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      onVerbatimBlock in class org.wikimodel.wem.PrintListener
    • onVerbatimInline

      public void onVerbatimInline(String str)
      Specified by:
      onVerbatimInline in interface org.wikimodel.wem.IWemListener
      Overrides:
      onVerbatimInline in class org.wikimodel.wem.PrintInlineListener
    • onMacroBlock

      public void onMacroBlock(String macroName, org.wikimodel.wem.WikiParameters params, String content)
      Specified by:
      onMacroBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      onMacroBlock in class org.wikimodel.wem.PrintListener
    • onMacroInline

      public void onMacroInline(String macroName, org.wikimodel.wem.WikiParameters params, String content)
      Specified by:
      onMacroInline in interface org.wikimodel.wem.IWemListener
      Overrides:
      onMacroInline in class org.wikimodel.wem.PrintListener
    • onExtensionBlock

      public void onExtensionBlock(String extensionName, org.wikimodel.wem.WikiParameters params)
      Specified by:
      onExtensionBlock in interface org.wikimodel.wem.IWemListener
      Overrides:
      onExtensionBlock in class org.wikimodel.wem.PrintListener
    • onExtensionInline

      public void onExtensionInline(String extensionName, org.wikimodel.wem.WikiParameters params)
      Specified by:
      onExtensionInline in interface org.wikimodel.wem.IWemListener
      Overrides:
      onExtensionInline in class org.wikimodel.wem.PrintInlineListener
    • onSpecialSymbol

      public void onSpecialSymbol(String str)
      Specified by:
      onSpecialSymbol in interface org.wikimodel.wem.IWemListener
      Overrides:
      onSpecialSymbol in class org.wikimodel.wem.PrintInlineListener
    • onSpace

      public void onSpace(String str)
      Specified by:
      onSpace in interface org.wikimodel.wem.IWemListener
      Overrides:
      onSpace in class org.wikimodel.wem.PrintTextListener
    • onNewLine

      public void onNewLine()
      Specified by:
      onNewLine in interface org.wikimodel.wem.IWemListener
      Overrides:
      onNewLine in class org.wikimodel.wem.PrintTextListener
    • onEscape

      public void onEscape(String str)
      Specified by:
      onEscape in interface org.wikimodel.wem.IWemListener
      Overrides:
      onEscape in class org.wikimodel.wem.PrintInlineListener
    • onWord

      public void onWord(String word)
      Specified by:
      onWord in interface org.wikimodel.wem.IWemListener
      Overrides:
      onWord in class org.wikimodel.wem.PrintTextListener
    • writeWord

      protected void writeWord(String word)
    • getSymbolEntity

      protected String getSymbolEntity(String str)
      Returns an HTML/XML entity corresponding to the specified special symbol. Depending on implementation it can be real entities (like & < > or the corresponding digital codes (like &, &#& or ›). Digital entity representation is better for generation of XML files.
      Parameters:
      str - the special string to convert to an HTML/XML entity
      Returns:
      an HTML/XML entity corresponding to the specified special symbol.
    • isHtmlEntities

      protected boolean isHtmlEntities()
      Returns true if special Wiki entities should be represented as the corresponding HTML entities or they should be visualized using the corresponding XHTML codes (like & and so on). This method can be overloaded in subclasses to re-define the visualization style.
      Returns:
      true if special Wiki entities should be represented as the corresponding HTML entities or they should be visualized using the corresponding XHTML codes (like & and so on).