I am following the guide for creating a Macro by extending AbstractMacro: 
http://rendering.xwiki.org/xwiki/bin/view/Main/ExtendingMacro although I have 
implemented it in Groovy rather than core Java.

I have managed to get the example to successfully build with maven and for the 
resulting JAR file to work with my xwiki Enterprise 4.4 install.

I then changed the content of the execute method to:

    List<Block> result = Arrays.<Block> asList(new WordBlock("|=one|=two"))
    return result

And added a new .test file:

    .runTransformations
    .#-----------------------------------------------------
    .input|xwiki/2.1
    .# Test the macro in standalone mode
    .#-----------------------------------------------------
    {{releases artifactIds="test1,test2" server="test3"/}}
    .#-----------------------------------------------------
    .expect|xhtml/1.0
    .#-----------------------------------------------------
    |=one|=two

This test passed when running the maven build, but produced the text output 
"|=one|=two" when deployed to xwiki, rather than rendering a table.  I then 
changed the execute method to:

    List<Block> result = Arrays.<Block> asList(new 
RawBlock("|=one|=two",Syntax.XWIKI_2_0))
    return result

with the same test as above.  This time the test does not pass, and fails with 
the error:

    releases1.test [xwiki/2.1, 
xhtml/1.0](org.xwiki.rendering.test.integration.RenderingTest): 
expected:<[|=one|=two]> but was:<[]>

When deployed to xwiki there is no output either.  As such, I can't seem to get 
RawBlock to actually output my pre-formatted xwiki code.

Am I doing something wrong with my use of RawBlock?
How can I get xwiki syntax content (e.g. a table) to output from the execute 
method so that a) the tests pass and b) the content is rendered into a table?

________________________________________________________________________
This e-mail has been scanned for all known viruses by Star Internet. The
service is powered by MessageLabs. 
________________________________________________________________________
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to