Class DefaultConfluenceWysiwygConverter
java.lang.Object
com.atlassian.confluence.pages.wysiwyg.DefaultConfluenceWysiwygConverter
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionconvertToPreview
(String inputText, String contentId, String spaceKey, String fromMode) Converts text into XHTML for PreviewconvertWikiMarkupToXHtml
(ContentEntityObject content, String wikiMarkup) Converts wiki markup text into XHTML, using the page context of the content object.convertWikiMarkupToXHtml
(ContentEntityObject content, String spaceKey, String wikiMarkup) Converts wiki markup text into XHTML, using the page context of the content object.convertWikiMarkupToXHtml
(String wikiMarkup, String pageId) Converts wiki markup text into XHTML, using the page context of the content object specified by the id.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.convertXHtmlToWikiMarkup
(ContentEntityObject content, String xhtml) Converts XHTML into wiki markup, using the page context of the content objectconvertXHtmlToWikiMarkup
(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)
-
Constructor Details
-
DefaultConfluenceWysiwygConverter
public DefaultConfluenceWysiwygConverter()
-
-
Method Details
-
setWysiwygConverter
public void setWysiwygConverter(com.atlassian.renderer.wysiwyg.WysiwygConverter converter) -
setWikiStyleRenderer
public void setWikiStyleRenderer(com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer) -
convertXHtmlToWikiMarkup
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
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
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
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
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
-