Class DefaultConfluenceWysiwygConverter
- java.lang.Object
-
- com.atlassian.confluence.pages.wysiwyg.DefaultConfluenceWysiwygConverter
-
- All Implemented Interfaces:
ConfluenceWysiwygConverter
public class DefaultConfluenceWysiwygConverter extends Object implements ConfluenceWysiwygConverter
When debugging this code, see SimpleMarkupTest for test cases. The XHTML coming into this code is not what is important -- you need to look at the post JTidy XHTML, which you can see in the 'out' ByteArray.Set debug to true below to see where newlines in the resulting Wiki markup are coming from.
-
-
Constructor Summary
Constructors Constructor Description DefaultConfluenceWysiwygConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
convertToPreview(String inputText, String contentId, String spaceKey, String fromMode)
Converts text into XHTML for PreviewString
convertWikiMarkupToXHtml(ContentEntityObject content, String wikiMarkup)
Converts wiki markup text into XHTML, using the page context of the content object.String
convertWikiMarkupToXHtml(ContentEntityObject content, String spaceKey, String wikiMarkup)
Converts wiki markup text into XHTML, using the page context of the content object.String
convertWikiMarkupToXHtml(String wikiMarkup, String pageId)
Converts wiki markup text into XHTML, using the page context of the content object specified by the id.String
convertWikiMarkupToXHtml(String wikiMarkup, String pageId, String spaceKey)
Converts wiki markup text into XHTML, using the page context of the content object specified by the id.String
convertXHtmlToWikiMarkup(ContentEntityObject content, String xhtml)
Converts XHTML into wiki markup, using the page context of the content objectString
convertXHtmlToWikiMarkup(String xhtml, String pageId)
Converts XHTML into wiki markup, without using page contextvoid
setContentEntityManager(ContentEntityManager contentEntityManager)
void
setWikiStyleRenderer(com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer)
void
setWysiwygConverter(com.atlassian.renderer.wysiwyg.WysiwygConverter converter)
-
-
-
Method Detail
-
setWysiwygConverter
public void setWysiwygConverter(com.atlassian.renderer.wysiwyg.WysiwygConverter converter)
-
setWikiStyleRenderer
public void setWikiStyleRenderer(com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer)
-
convertXHtmlToWikiMarkup
public String convertXHtmlToWikiMarkup(ContentEntityObject content, String xhtml)
Description copied from interface:ConfluenceWysiwygConverter
Converts XHTML into wiki markup, using the page context of the content object- Specified by:
convertXHtmlToWikiMarkup
in interfaceConfluenceWysiwygConverter
- Parameters:
content
- - the content object the markup is writen withinxhtml
- - the text to be converted- Returns:
- converted wiki markup
-
convertWikiMarkupToXHtml
public String convertWikiMarkupToXHtml(ContentEntityObject content, String wikiMarkup)
Description copied from interface:ConfluenceWysiwygConverter
Converts wiki markup text into XHTML, using the page context of the content object. If content is null, use convertWikiMarkupToXHtml(ContentEntityObject content, String spaceKey, String wikiMarkup)- Specified by:
convertWikiMarkupToXHtml
in interfaceConfluenceWysiwygConverter
- Parameters:
content
- - the object the markup is written withinwikiMarkup
- - the text to be converted- Returns:
- converted XHTML
-
convertWikiMarkupToXHtml
public String convertWikiMarkupToXHtml(ContentEntityObject content, String spaceKey, String wikiMarkup)
Description copied from interface:ConfluenceWysiwygConverter
Converts wiki markup text into XHTML, using the page context of the content object. If content is null, the spaceKey is used to define the page context.- Specified by:
convertWikiMarkupToXHtml
in interfaceConfluenceWysiwygConverter
- Parameters:
content
- - the object the markup is written withinspaceKey
- - the space in which the content is written, used when content is nullwikiMarkup
- - the text to be converted- Returns:
- converted XHTML
-
convertXHtmlToWikiMarkup
public String convertXHtmlToWikiMarkup(String xhtml, String pageId)
Description copied from interface:ConfluenceWysiwygConverter
Converts XHTML into wiki markup, without using page context- Specified by:
convertXHtmlToWikiMarkup
in interfaceConfluenceWysiwygConverter
- Parameters:
xhtml
- - the text to be convertedpageId
- - NOT USED- Returns:
- converted wiki markup
-
convertWikiMarkupToXHtml
public String convertWikiMarkupToXHtml(String wikiMarkup, String pageId)
Description copied from interface:ConfluenceWysiwygConverter
Converts wiki markup text into XHTML, using the page context of the content object specified by the id. If content is null, use convertWikiMarkupToXHtml(ContentEntityObject content, String spaceKey, String wikiMarkup)- Specified by:
convertWikiMarkupToXHtml
in interfaceConfluenceWysiwygConverter
- Parameters:
wikiMarkup
- - the text to be convertedpageId
- - id of the object- Returns:
- converted XHTML
-
convertWikiMarkupToXHtml
public String convertWikiMarkupToXHtml(String wikiMarkup, String pageId, String spaceKey)
Description copied from interface:ConfluenceWysiwygConverter
Converts wiki markup text into XHTML, using the page context of the content object specified by the id. If content is null, the spaceKey is used to define the page context.- Specified by:
convertWikiMarkupToXHtml
in interfaceConfluenceWysiwygConverter
- Parameters:
wikiMarkup
- - the text to be convertedpageId
- - id of the objectspaceKey
- - the space in which the content is written, used when content is null- Returns:
- converted XHTML
-
convertToPreview
public String convertToPreview(String inputText, String contentId, String spaceKey, String fromMode)
Description copied from interface:ConfluenceWysiwygConverter
Converts text into XHTML for Preview- Specified by:
convertToPreview
in interfaceConfluenceWysiwygConverter
- Parameters:
inputText
- - text to be converted (can be either XHTML or Wiki Markup)contentId
- - the id of the content that the text is written withinspaceKey
- - if the content object doesn't exist the space key is usedfromMode
- - the form that the text is in (AbstractPageAction.RICHTEXT or AbstractPageAction.MARKUP)- Returns:
- converted XHTML
-
setContentEntityManager
public void setContentEntityManager(ContentEntityManager contentEntityManager)
-
-