Is it possible to pass an array as a macro parameter? So far my attempts have 
failed.

Macro code:
#set( $a = $xcontext.macro.params.array)
$a

#foreach($i in $a)
  $i
#end


Page code:
#set( $array = ['Chapter 1', 'Chapter 2', 'Chapter 3'])
$array

#foreach($i in $array)
  $i
#end

{{test array=$array/}}


The array processed in the page works as expected. The array passed to the 
macro only prints up to the first space between Chapter and 1. I have also 
tried to enter the array as a string which passes the string but the macro does 
not treat it as an array, which doesn’t surprise me. The comments from Stefan 
and Vincent on 
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial seem to 
touch on this issue but I do not understand the answer provided. Thank you for 
any clarification to this issue you can provide.

Regards,

Jesse Bright
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to