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 Summary
Fields Modifier and Type Field Description protected WikiSerializer
engine
protected freemarker.core.Environment
env
protected static String
LINE_SEP
static Log
log
protected int
mark
protected Toc
toc
protected StringBuilder
words
protected WikiWriter
writer
-
Constructor Summary
Constructors Constructor Description WikiSerializerHandler(WikiSerializer engine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginDefinitionDescription()
void
beginDefinitionList(org.wikimodel.wem.WikiParameters parameters)
void
beginDefinitionTerm()
void
beginDocument()
protected void
beginElement()
void
beginFormat(org.wikimodel.wem.WikiFormat format)
void
beginHeader(int level, org.wikimodel.wem.WikiParameters params)
void
beginInfoBlock(char infoType, org.wikimodel.wem.WikiParameters params)
void
beginList(org.wikimodel.wem.WikiParameters parameters, boolean ordered)
void
beginListItem()
void
beginParagraph(org.wikimodel.wem.WikiParameters params)
void
beginPropertyBlock(String propertyUri, boolean doc)
void
beginPropertyInline(String str)
void
beginQuotation(org.wikimodel.wem.WikiParameters params)
void
beginQuotationLine()
void
beginTable(org.wikimodel.wem.WikiParameters params)
void
beginTableCell(boolean tableHead, org.wikimodel.wem.WikiParameters params)
void
beginTableRow(org.wikimodel.wem.WikiParameters params)
void
endDefinitionDescription()
void
endDefinitionList(org.wikimodel.wem.WikiParameters parameters)
void
endDefinitionTerm()
void
endDocument()
protected void
endElement()
void
endFormat(org.wikimodel.wem.WikiFormat format)
void
endHeader(int level, org.wikimodel.wem.WikiParameters params)
void
endInfoBlock(char infoType, org.wikimodel.wem.WikiParameters params)
void
endList(org.wikimodel.wem.WikiParameters parameters, boolean ordered)
void
endListItem()
void
endParagraph(org.wikimodel.wem.WikiParameters params)
void
endPropertyBlock(String propertyUri, boolean doc)
void
endPropertyInline(String inlineProperty)
void
endQuotation(org.wikimodel.wem.WikiParameters params)
void
endQuotationLine()
void
endTable(org.wikimodel.wem.WikiParameters params)
void
endTableCell(boolean tableHead, org.wikimodel.wem.WikiParameters params)
void
endTableRow(org.wikimodel.wem.WikiParameters params)
protected void
flushWords()
freemarker.core.Environment
getEnvironment()
protected String
getSymbolEntity(String str)
Returns an HTML/XML entity corresponding to the specified special symbol.WikiWriter
getWriter()
protected boolean
isHtmlEntities()
Returnstrue
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).void
onEmptyLines(int count)
void
onEscape(String str)
void
onExtensionBlock(String extensionName, org.wikimodel.wem.WikiParameters params)
void
onExtensionInline(String extensionName, org.wikimodel.wem.WikiParameters params)
void
onHorizontalLine()
void
onLineBreak()
void
onMacroBlock(String macroName, org.wikimodel.wem.WikiParameters params, String content)
void
onMacroInline(String macroName, org.wikimodel.wem.WikiParameters params, String content)
void
onNewLine()
void
onReference(String ref, boolean explicitLink)
void
onSpace(String str)
void
onSpecialSymbol(String str)
void
onTableCaption(String str)
void
onVerbatimBlock(String str)
void
onVerbatimInline(String str)
void
onWord(String word)
protected void
print(String str)
protected void
println()
protected void
println(String str)
protected void
writeWord(String word)
-
-
-
Field Detail
-
log
public static final Log log
-
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 Detail
-
WikiSerializerHandler
public WikiSerializerHandler(WikiSerializer engine)
-
-
Method Detail
-
print
protected void print(String str)
- Overrides:
print
in classorg.wikimodel.wem.PrintTextListener
-
println
protected void println()
- Overrides:
println
in classorg.wikimodel.wem.PrintTextListener
-
println
protected void println(String str)
- Overrides:
println
in classorg.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 interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginDefinitionDescription
in classorg.wikimodel.wem.PrintListener
-
beginDefinitionList
public void beginDefinitionList(org.wikimodel.wem.WikiParameters parameters)
- Specified by:
beginDefinitionList
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginDefinitionList
in classorg.wikimodel.wem.PrintListener
-
beginDefinitionTerm
public void beginDefinitionTerm()
- Specified by:
beginDefinitionTerm
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginDefinitionTerm
in classorg.wikimodel.wem.PrintListener
-
beginDocument
public void beginDocument()
- Specified by:
beginDocument
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginDocument
in classorg.wikimodel.wem.PrintListener
-
beginFormat
public void beginFormat(org.wikimodel.wem.WikiFormat format)
- Specified by:
beginFormat
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginFormat
in classorg.wikimodel.wem.PrintInlineListener
-
beginHeader
public void beginHeader(int level, org.wikimodel.wem.WikiParameters params)
- Specified by:
beginHeader
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginHeader
in classorg.wikimodel.wem.PrintListener
-
beginInfoBlock
public void beginInfoBlock(char infoType, org.wikimodel.wem.WikiParameters params)
- Specified by:
beginInfoBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginInfoBlock
in classorg.wikimodel.wem.PrintListener
-
beginList
public void beginList(org.wikimodel.wem.WikiParameters parameters, boolean ordered)
- Specified by:
beginList
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginList
in classorg.wikimodel.wem.PrintListener
-
beginListItem
public void beginListItem()
- Specified by:
beginListItem
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginListItem
in classorg.wikimodel.wem.PrintListener
-
beginParagraph
public void beginParagraph(org.wikimodel.wem.WikiParameters params)
- Specified by:
beginParagraph
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginParagraph
in classorg.wikimodel.wem.PrintListener
-
beginPropertyBlock
public void beginPropertyBlock(String propertyUri, boolean doc)
- Specified by:
beginPropertyBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginPropertyBlock
in classorg.wikimodel.wem.PrintListener
-
beginPropertyInline
public void beginPropertyInline(String str)
- Specified by:
beginPropertyInline
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginPropertyInline
in classorg.wikimodel.wem.PrintInlineListener
-
beginQuotation
public void beginQuotation(org.wikimodel.wem.WikiParameters params)
- Specified by:
beginQuotation
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginQuotation
in classorg.wikimodel.wem.PrintListener
-
beginQuotationLine
public void beginQuotationLine()
- Specified by:
beginQuotationLine
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginQuotationLine
in classorg.wikimodel.wem.PrintListener
-
beginTable
public void beginTable(org.wikimodel.wem.WikiParameters params)
- Specified by:
beginTable
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginTable
in classorg.wikimodel.wem.PrintListener
-
beginTableCell
public void beginTableCell(boolean tableHead, org.wikimodel.wem.WikiParameters params)
- Specified by:
beginTableCell
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginTableCell
in classorg.wikimodel.wem.PrintListener
-
beginTableRow
public void beginTableRow(org.wikimodel.wem.WikiParameters params)
- Specified by:
beginTableRow
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
beginTableRow
in classorg.wikimodel.wem.PrintListener
-
endDefinitionDescription
public void endDefinitionDescription()
- Specified by:
endDefinitionDescription
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endDefinitionDescription
in classorg.wikimodel.wem.PrintListener
-
endDefinitionList
public void endDefinitionList(org.wikimodel.wem.WikiParameters parameters)
- Specified by:
endDefinitionList
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endDefinitionList
in classorg.wikimodel.wem.PrintListener
-
endDefinitionTerm
public void endDefinitionTerm()
- Specified by:
endDefinitionTerm
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endDefinitionTerm
in classorg.wikimodel.wem.PrintListener
-
endDocument
public void endDocument()
- Specified by:
endDocument
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endDocument
in classorg.wikimodel.wem.PrintListener
-
endFormat
public void endFormat(org.wikimodel.wem.WikiFormat format)
- Specified by:
endFormat
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endFormat
in classorg.wikimodel.wem.PrintInlineListener
-
endHeader
public void endHeader(int level, org.wikimodel.wem.WikiParameters params)
- Specified by:
endHeader
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endHeader
in classorg.wikimodel.wem.PrintListener
-
endInfoBlock
public void endInfoBlock(char infoType, org.wikimodel.wem.WikiParameters params)
- Specified by:
endInfoBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endInfoBlock
in classorg.wikimodel.wem.PrintListener
-
endList
public void endList(org.wikimodel.wem.WikiParameters parameters, boolean ordered)
- Specified by:
endList
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endList
in classorg.wikimodel.wem.PrintListener
-
endListItem
public void endListItem()
- Specified by:
endListItem
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endListItem
in classorg.wikimodel.wem.PrintListener
-
endParagraph
public void endParagraph(org.wikimodel.wem.WikiParameters params)
- Specified by:
endParagraph
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endParagraph
in classorg.wikimodel.wem.PrintListener
-
endPropertyBlock
public void endPropertyBlock(String propertyUri, boolean doc)
- Specified by:
endPropertyBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endPropertyBlock
in classorg.wikimodel.wem.PrintListener
-
endPropertyInline
public void endPropertyInline(String inlineProperty)
- Specified by:
endPropertyInline
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endPropertyInline
in classorg.wikimodel.wem.PrintInlineListener
-
endQuotation
public void endQuotation(org.wikimodel.wem.WikiParameters params)
- Specified by:
endQuotation
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endQuotation
in classorg.wikimodel.wem.PrintListener
-
endQuotationLine
public void endQuotationLine()
- Specified by:
endQuotationLine
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endQuotationLine
in classorg.wikimodel.wem.PrintListener
-
endTable
public void endTable(org.wikimodel.wem.WikiParameters params)
- Specified by:
endTable
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endTable
in classorg.wikimodel.wem.PrintListener
-
endTableCell
public void endTableCell(boolean tableHead, org.wikimodel.wem.WikiParameters params)
- Specified by:
endTableCell
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endTableCell
in classorg.wikimodel.wem.PrintListener
-
endTableRow
public void endTableRow(org.wikimodel.wem.WikiParameters params)
- Specified by:
endTableRow
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
endTableRow
in classorg.wikimodel.wem.PrintListener
-
onEmptyLines
public void onEmptyLines(int count)
- Specified by:
onEmptyLines
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onEmptyLines
in classorg.wikimodel.wem.PrintListener
-
onHorizontalLine
public void onHorizontalLine()
- Specified by:
onHorizontalLine
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onHorizontalLine
in classorg.wikimodel.wem.PrintListener
-
onLineBreak
public void onLineBreak()
- Specified by:
onLineBreak
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onLineBreak
in classorg.wikimodel.wem.PrintInlineListener
-
onReference
public void onReference(String ref, boolean explicitLink)
- Specified by:
onReference
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onReference
in classorg.wikimodel.wem.PrintTextListener
-
onTableCaption
public void onTableCaption(String str)
- Specified by:
onTableCaption
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onTableCaption
in classorg.wikimodel.wem.PrintListener
-
onVerbatimBlock
public void onVerbatimBlock(String str)
- Specified by:
onVerbatimBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onVerbatimBlock
in classorg.wikimodel.wem.PrintListener
-
onVerbatimInline
public void onVerbatimInline(String str)
- Specified by:
onVerbatimInline
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onVerbatimInline
in classorg.wikimodel.wem.PrintInlineListener
-
onMacroBlock
public void onMacroBlock(String macroName, org.wikimodel.wem.WikiParameters params, String content)
- Specified by:
onMacroBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onMacroBlock
in classorg.wikimodel.wem.PrintListener
-
onMacroInline
public void onMacroInline(String macroName, org.wikimodel.wem.WikiParameters params, String content)
- Specified by:
onMacroInline
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onMacroInline
in classorg.wikimodel.wem.PrintListener
-
onExtensionBlock
public void onExtensionBlock(String extensionName, org.wikimodel.wem.WikiParameters params)
- Specified by:
onExtensionBlock
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onExtensionBlock
in classorg.wikimodel.wem.PrintListener
-
onExtensionInline
public void onExtensionInline(String extensionName, org.wikimodel.wem.WikiParameters params)
- Specified by:
onExtensionInline
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onExtensionInline
in classorg.wikimodel.wem.PrintInlineListener
-
onSpecialSymbol
public void onSpecialSymbol(String str)
- Specified by:
onSpecialSymbol
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onSpecialSymbol
in classorg.wikimodel.wem.PrintInlineListener
-
onSpace
public void onSpace(String str)
- Specified by:
onSpace
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onSpace
in classorg.wikimodel.wem.PrintTextListener
-
onNewLine
public void onNewLine()
- Specified by:
onNewLine
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onNewLine
in classorg.wikimodel.wem.PrintTextListener
-
onEscape
public void onEscape(String str)
- Specified by:
onEscape
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onEscape
in classorg.wikimodel.wem.PrintInlineListener
-
onWord
public void onWord(String word)
- Specified by:
onWord
in interfaceorg.wikimodel.wem.IWemListener
- Overrides:
onWord
in classorg.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()
Returnstrue
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).
-
-