Looks like you are mixing several things here.

RawBlock job is to provide something that should ends up in the output
syntax as it is but the xhtml renderer can't support something that is
in xwiki syntax so it skips it which is why you don't get anything.

When you say that you want a WordBlock("|=one|=two") by definition
this is not going to be interpreted since you already said this was a
word so whatever the renderer it will get a event saying that you want
to print something that exactly looks like "|=one|=two" and the
renderer should make sure it will looks like this (the html renderer
will escape < and > when you have some for example etc.)

If you want your macro to return a table you should explicitly return
a table which mean use
TableBlock/TableRowBlock/TableCellBlock/TableHeadCellBlock.

On Wed, Jan 9, 2013 at 1:52 PM, David Cornforth
<[email protected]> wrote:
> 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



-- 
Thomas Mortagne
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to