Package org.apache.wiki.htmltowiki.syntax

# Class WikiSyntaxDecorator

java.lang.Object
org.apache.wiki.htmltowiki.syntax.WikiSyntaxDecorator

All Implemented Interfaces:
  `SyntaxDecorator`

Direct Known Subclasses:
  `JSPWikiSyntaxDecorator`

public abstract class WikiSyntaxDecorator extends Object implements SyntaxDecorator

Base Syntax decorator which translates to JSPWiki syntax. Delegates each kind of XHTML element to its specific decorator.

This class is useful when developing a new wiki syntax decorator - just extend from it and provide the implementations of all the needed Decorators on the `SyntaxDecorator.init(PrintWriter, Deque, Deque, WhitespaceTrimWriter, XHtmlToWikiConfig, XHtmlElementToWikiTranslator)` method

## Field Summary

Fields
Modifier and Type
Field
Description
`protected ADecorator`
`a`
`protected BrDecorator`
`br`
`protected XHtmlElementToWikiTranslator`
`chain`
`protected CodeDecorator`
`code`
`protected XHtmlToWikiConfig`
`config`
`protected PlainTextCssDecorator`
`css`
`protected PlainTextCssSpecialDecorator`
`cssStyle`
`protected DdDecorator`
`dd`
`protected DlDecorator`
`dl`
`protected DtDecorator`
`dt`
`protected PlainTextItalicDecorator`
`em`
`protected FormDecorator`
`form`
`protected H1Decorator`
`h1`
`protected H2Decorator`
`h2`
`protected H3Decorator`
`h3`
`protected H4Decorator`
`h4`
`protected HrDecorator`
`hr`
`protected ImageDecorator`
`img`
`protected InputDecorator`
`input`
`protected LiDecorator`
`li`
`protected OlDecorator`
`ol`
`protected OptionDecorator`
`option`
`protected WhitespaceTrimWriter`
`outTrimmer`
`protected PDecorator`
`p`
`protected PlainTextDecorator`
`plainText`
`protected PlainTextMonospaceDecorator`
`pre`
`protected SelectDecorator`
`select`
`protected StrikeDecorator`
`strike`
`protected PlainTextBoldDecorator`
`strong`
`protected SubDecorator`
`sub`
`protected SupDecorator`
`sup`
`protected TableDecorator`
`table`
`protected TbodyDecorator`
`tbody`
`protected TdDecorator`
`td`
`protected TextAreaDecorator`
`textarea`
`protected TextElementDecorator`
`textElement`
`protected ThDecorator`
`th`
`protected TheadDecorator`
`thead`
`protected TrDecorator`
`tr`
`protected UlDecorator`
`ul`
`protected UnderlineDecorator`
`underline`

## Constructor Summary

Constructors
Constructor
Description
`WikiSyntaxDecorator()`

## Method Summary

Modifier and Type
Method
Description
`void`
`a(org.jdom2.Element e, String ref)`
Decorates an `a` element.
`void`
`aFootnote(String text, String ref)`
Decorates an `a` element, pointing to a footnote.
`void`
`aUndefined(org.jdom2.Element e)`
Decorates an `a` element to an undefined page.
`void`
`br(org.jdom2.Element base, org.jdom2.Element e)`
Decorates a `br` element.
`void`
`code(org.jdom2.Element e)`
Decorates a `code` ot `tt` element.
`void`
`dd(org.jdom2.Element e)`
Decorates a `dd` element.
`void`
`dl(org.jdom2.Element e)`
Decorates a `dl` element.
`void`
`dt(org.jdom2.Element e)`
Decorates a `dt` element.
`void`
`em(org.jdom2.Element e)`
Decorates an `em`, `i` or `address` element.
`void`
`form(org.jdom2.Element e)`
Decorates a `form` element.
`void`
`h1(org.jdom2.Element e)`
Decorates an `h1` element.
`void`
`h2(org.jdom2.Element e)`
Decorates an `h2` element.
`void`
`h3(org.jdom2.Element e)`
Decorates an `h3` element.
`void`
`h4(org.jdom2.Element e)`
Decorates an `h4` element.
`void`
`hr(org.jdom2.Element e)`
Decorates an `hr` element.
`void`
`image(String src, Map<String,Object> imageAttrs)`
Decorates an image element.
`void`
`img(org.jdom2.Element e)`
Decorates an image element.
`void`
`input(org.jdom2.Element e)`
Decorates an `input` element.
`void`
`li(org.jdom2.Element base, org.jdom2.Element e)`
Decorates a `li` element.
`void`
`ol(org.jdom2.Element e)`
Decorates an `ol` element.
`void`
`option(org.jdom2.Element base, org.jdom2.Element e)`
Decorates an `option` element.
`void`
`p(org.jdom2.Element e)`
Decorates a `p` element.
`void`
`paragraph(XHtmlElementToWikiTranslator.ElementDecoratorData dto)`
Decorates a text paragraph.
`void`
`pre(org.jdom2.Element e)`
Decorates a `pre` element.
`void`
`select(org.jdom2.Element e)`
Decorates a `select` element.
`void`
`strike(org.jdom2.Element e)`
Decorates a `strike` element.
`void`
`strong(org.jdom2.Element e)`
Decorates a `strong` or `b` element.
`void`
`sub(org.jdom2.Element e)`
Decorates a `sub` element.
`void`
`sup(org.jdom2.Element e)`
Decorates an `sup` element.
`void`
`table(org.jdom2.Element e)`
Decorates a `table` element.
`void`
`tbody(org.jdom2.Element e)`
Decorates a `tbody` element.
`void`
`td(org.jdom2.Element e)`
Decorates an `td` element.
`void`
`text(org.jdom2.Text element)`
Decorates a text element.
`void`
`textarea(org.jdom2.Element e)`
Decorates a `textarea` element.
`void`
`th(org.jdom2.Element e)`
Decorates a `th` element.
`void`
`thead(org.jdom2.Element e)`
Decorates a `thead` element.
`void`
`tr(org.jdom2.Element e)`
Decorates a `tr` element.
`void`
`ul(org.jdom2.Element e)`
Decorates an `ul` element.
`void`
`underline(org.jdom2.Element e)`
Decorates an `underline` element.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.wiki.htmltowiki.SyntaxDecorator

`init`

## Field Details

### a

protected ADecorator a

### br

protected BrDecorator br

### code

protected CodeDecorator code

### dd

protected DdDecorator dd

### dl

protected DlDecorator dl

### dt

protected DtDecorator dt

### form

protected FormDecorator form

### hr

protected HrDecorator hr

### h1

protected H1Decorator h1

### h2

protected H2Decorator h2

### h3

protected H3Decorator h3

### h4

protected H4Decorator h4

### img

protected ImageDecorator img

### input

protected InputDecorator input

### li

protected LiDecorator li

### ol

protected OlDecorator ol

### option

protected OptionDecorator option

### p

protected PDecorator p

### plainText

protected PlainTextDecorator plainText

### strong

protected PlainTextBoldDecorator strong

### css

protected PlainTextCssDecorator css

### cssStyle

protected PlainTextCssSpecialDecorator cssStyle

### em

protected PlainTextItalicDecorator em

### pre

protected PlainTextMonospaceDecorator pre

### select

protected SelectDecorator select

### strike

protected StrikeDecorator strike

### sub

protected SubDecorator sub

### sup

protected SupDecorator sup

### table

protected TableDecorator table

### tbody

protected TbodyDecorator tbody

### td

protected TdDecorator td

### textarea

protected TextAreaDecorator textarea

### textElement

protected TextElementDecorator textElement

### th

protected ThDecorator th

### thead

protected TheadDecorator thead

### tr

protected TrDecorator tr

### ul

protected UlDecorator ul

### underline

protected UnderlineDecorator underline

### outTrimmer

protected WhitespaceTrimWriter outTrimmer

### chain

protected XHtmlElementToWikiTranslator chain

### config

protected XHtmlToWikiConfig config

## Constructor Details

### WikiSyntaxDecorator

public WikiSyntaxDecorator()

## Method Details

### a

public void a(org.jdom2.Element e, String ref) throws org.jdom2.JDOMException
Decorates an `a` element.

Specified by:
  `a` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
  `ref` - actual link.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### aFootnote

public void aFootnote(String text, String ref)
Decorates an `a` element, pointing to a footnote.

Specified by:
  `aFootnote` in interface `SyntaxDecorator`
Parameters:
  `text` - text link of the footnote.
  `ref` - link to footnote.

### aUndefined

public void aUndefined(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `a` element to an undefined page.

Specified by:
  `aUndefined` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### br

public void br(org.jdom2.Element base, org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `br` element.

Specified by:
  `br` in interface `SyntaxDecorator`
Parameters:
  `base` - parent of the XHTML element being translated.
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### code

public void code(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `code` ot `tt` element.

Specified by:
  `code` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### dd

public void dd(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `dd` element.

Specified by:
  `dd` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### dl

public void dl(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `dl` element.

Specified by:
  `dl` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### dt

public void dt(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `dt` element.

Specified by:
  `dt` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### em

public void em(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `em`, `i` or `address` element.

Specified by:
  `em` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### form

public void form(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `form` element.

Specified by:
  `form` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### hr

public void hr(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `hr` element.

Specified by:
  `hr` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### h1

public void h1(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `h1` element.

Specified by:
  `h1` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### h2

public void h2(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `h2` element.

Specified by:
  `h2` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### h3

public void h3(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `h3` element.

Specified by:
  `h3` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### h4

public void h4(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `h4` element.

Specified by:
  `h4` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### image

public void image(String src, Map<String,Object> imageAttrs)
Decorates an image element. This is a terminal operation, that is, chain is not expected to be called by this method.

Specified by:
  `image` in interface `SyntaxDecorator`
Parameters:
  `src` - image source
  `imageAttrs` - image attributes

### img

public void img(org.jdom2.Element e)
Decorates an image element. This is a terminal operation, that is, chain is not expected to be called by this method.

Specified by:
  `img` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.

### input

public void input(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `input` element.

Specified by:
  `input` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### li

public void li(org.jdom2.Element base, org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `li` element.

Specified by:
  `li` in interface `SyntaxDecorator`
Parameters:
  `base` - parent of the XHTML element being translated.
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### ol

public void ol(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `ol` element.

Specified by:
  `ol` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### option

public void option(org.jdom2.Element base, org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `option` element.

Specified by:
  `option` in interface `SyntaxDecorator`
Parameters:
  `base` - parent of the XHTML element being translated.
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### p

public void p(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `p` element.

Specified by:
  `p` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### paragraph

public void paragraph(XHtmlElementToWikiTranslator.ElementDecoratorData dto) throws org.jdom2.JDOMException
Decorates a text paragraph.

Specified by:
  `paragraph` in interface `SyntaxDecorator`
Parameters:
  `dto` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### pre

public void pre(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `pre` element.

Specified by:
  `pre` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### strong

public void strong(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `strong` or `b` element.

Specified by:
  `strong` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### table

public void table(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `table` element.

Specified by:
  `table` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### tbody

public void tbody(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `tbody` element.

Specified by:
  `tbody` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### td

public void td(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `td` element.

Specified by:
  `td` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### text

public void text(org.jdom2.Text element)
Decorates a text element. This is a terminal operation, that is, chain is not expected to be called by this method.

Specified by:
  `text` in interface `SyntaxDecorator`
Parameters:
  `element` - XHTML element being translated.

### textarea

public void textarea(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `textarea` element.

Specified by:
  `textarea` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### th

public void th(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `th` element.

Specified by:
  `th` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### thead

public void thead(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `thead` element.

Specified by:
  `thead` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### tr

public void tr(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `tr` element.

Specified by:
  `tr` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### select

public void select(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `select` element.

Specified by:
  `select` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### strike

public void strike(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `strike` element.

Specified by:
  `strike` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### sub

public void sub(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates a `sub` element.

Specified by:
  `sub` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### sup

public void sup(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `sup` element.

Specified by:
  `sup` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### ul

public void ul(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `ul` element.

Specified by:
  `ul` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.

### underline

public void underline(org.jdom2.Element e) throws org.jdom2.JDOMException
Decorates an `underline` element.

Specified by:
  `underline` in interface `SyntaxDecorator`
Parameters:
  `e` - XHTML element being translated.
Throws:
  `org.jdom2.JDOMException` - if an error has ocurred parsing the xhtml chain.