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 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

      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
    • 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
    • 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
    • setContentEntityManager

      public void setContentEntityManager(ContentEntityManager contentEntityManager)