com.atlassian.confluence.pages.wysiwyg
Class DefaultConfluenceWysiwygConverter

java.lang.Object
  extended by 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
DefaultConfluenceWysiwygConverter()
           
 
Method Summary
 String convertToPreview(String inputText, String contentId, String spaceKey, String fromMode)
          Converts text into XHTML for Preview
 String 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 convertWikiMarkupToXHtmlWithoutPage(String wikiMarkup, String pageId)
          TODO - remove this method from the interface
 String convertXHtmlToWikiMarkup(ContentEntityObject content, String xhtml)
          Converts XHTML into wiki markup, using the page context of the content object
 String convertXHtmlToWikiMarkup(String xhtml, String pageId)
          Converts XHTML into wiki markup, without using page context
 String convertXHtmlToWikiMarkupWithoutPage(String xhtml, String pageId)
          TODO - remove this method from the interface
 boolean getUserWysiwygPreference()
          Deprecated. since 4.0. Always returns true.
 void setContentEntityManager(ContentEntityManager contentEntityManager)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setWikiStyleRenderer(com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer)
           
 void setWysiwygConverter(com.atlassian.renderer.wysiwyg.WysiwygConverter converter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConfluenceWysiwygConverter

public DefaultConfluenceWysiwygConverter()
Method Detail

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

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 interface ConfluenceWysiwygConverter
Parameters:
content - - the content object the markup is writen within
xhtml - - 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 interface ConfluenceWysiwygConverter
Parameters:
content - - the object the markup is written within
wikiMarkup - - 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 interface ConfluenceWysiwygConverter
Parameters:
content - - the object the markup is written within
spaceKey - - the space in which the content is written, used when content is null
wikiMarkup - - the text to be converted
Returns:
converted XHTML

convertXHtmlToWikiMarkupWithoutPage

public String convertXHtmlToWikiMarkupWithoutPage(String xhtml,
                                                  String pageId)
Description copied from interface: ConfluenceWysiwygConverter
TODO - remove this method from the interface

Specified by:
convertXHtmlToWikiMarkupWithoutPage in interface ConfluenceWysiwygConverter
Parameters:
xhtml - - the text to be converted
pageId - - NOT USED
Returns:
converted wiki markup

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 interface ConfluenceWysiwygConverter
Parameters:
xhtml - - the text to be converted
pageId - - NOT USED
Returns:
converted wiki markup

convertWikiMarkupToXHtmlWithoutPage

public String convertWikiMarkupToXHtmlWithoutPage(String wikiMarkup,
                                                  String pageId)
Description copied from interface: ConfluenceWysiwygConverter
TODO - remove this method from the interface

Specified by:
convertWikiMarkupToXHtmlWithoutPage in interface ConfluenceWysiwygConverter
Parameters:
wikiMarkup - - the text to be converted
pageId - - id of the object
Returns:
converted XHTML

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 interface ConfluenceWysiwygConverter
Parameters:
wikiMarkup - - the text to be converted
pageId - - 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 interface ConfluenceWysiwygConverter
Parameters:
wikiMarkup - - the text to be converted
pageId - - id of the object
spaceKey - - 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 interface ConfluenceWysiwygConverter
Parameters:
inputText - - text to be converted (can be either XHTML or Wiki Markup)
contentId - - the id of the content that the text is written within
spaceKey - - if the content object doesn't exist the space key is used
fromMode - - the form that the text is in (AbstractPageAction.RICHTEXT or AbstractPageAction.MARKUP)
Returns:
converted XHTML

getUserWysiwygPreference

@Deprecated
public boolean getUserWysiwygPreference()
Deprecated. since 4.0. Always returns true.

Description copied from interface: ConfluenceWysiwygConverter
Retrieves the user's WYSIWYG editor preference and returns it. If the preference isn't set, the global settings are checked and returned.

Specified by:
getUserWysiwygPreference in interface ConfluenceWysiwygConverter
Returns:
True if the use has set the WYSIWYG editor as the default, false otherwise

setContentEntityManager

public void setContentEntityManager(ContentEntityManager contentEntityManager)


Copyright © 2003-2012 Atlassian. All Rights Reserved.