7 Replies Latest reply on Dec 9, 2011 8:22 AM by Brian.Welter

    How do I get my macro to convert internal format codes to HTML?


      Originally from Building Macros....


      I got my first simple macro working OK - very similar to the example here, just different formatting around the text.  My n00b question is how do I explicitly convert the text from jive-format to HTML?  Everything worked great when I tested with unformatted text, but of course the first time the user tried it, they were using text that had been formatted (font size) and so the jive-format tags came straight through on the rendered output like this:


      {font:style=font-size: 12pt;}blah blah blah text {font}


      ...instead of "blah blah blah text" in 12 point font.  Any quick snippet I can use to do this conversion, or a good bit of sample code I can refer to?


      Brian's suggestion was :


      RenderUtils.renderStringToHtml(source, text)

      source is a JiveObject and text is the String to render...since you don't really have a JiveObject to provide the method, you could give it an arbitrary object like the root community.


      RenderUtils.renderStringToHtml( JiveApplication.getContext().getCommunityManager().getRootCommunity(), "string to render");


      See my source attached....