Uploaded image for project: 'Confluence'
  1. Confluence
  2. CONFLUENCE-51

Converter doesn't process {code} macro inside {panel} macro

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 9.0
    • Syntax - Confluence
    • None

    Description

      CONTEXT:

      Using the converter documented here :

      I've encountered an issue with code inside panel.

      The Confluence syntax :

      * {panel}{code}code{code}{panel}
      

      Should convert to (with may be some CR/LF):

      * {{panel}}{{code}}code{{/code}}{{/panel}}
      

      But returns

      * {{panel}}{code}code{code}{{/panel}}
      

      The code:

        public static String transformContent(String content) throws Exception {
          EmbeddableComponentManager ecm = new EmbeddableComponentManager();
          ecm.initialize(Thread.currentThread().getContextClassLoader());
            Converter converter = ecm.lookup(Converter.class);
      
            WikiPrinter printer = new DefaultWikiPrinter();
            converter.convert(new StringReader(content), Syntax.CONFLUENCE_1_0, Syntax.XWIKI_2_0, printer);
            return printer.toString();
         }
      

      The test (JUnit 3.8):

      import junit.framework.TestCase;
      
      public class SyntaxTransformerTest extends TestCase {
        public void testPanel() {
      	  assertTransformTest("{panel}panel{panel}", "{{panel}}\npanel\n{{/panel}}");
        }
      
        public void testPanelAndCode() {
      	  assertTransformTest("{panel}panel{code}code{code}panel{panel}", "{{panel}}\npanel{{code}} code {{/code}}\n{{/panel}}");
        }
        
        public void testCode() {
      	  assertTransformTest("{code}code{code}", "{{code}}\ncode\n{{/code}}");
        }
      
        public void assertTransformTest(String content, String expected) {
          final String result = SyntaxTransformer.transformContent(content);
          assertEquals(expected, result); 
        }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            dbaeli Dimitri BAELI
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: