On Feb 23, 2010, at 10:07 AM, Thomas Mortagne wrote:
> On Tue, Feb 23, 2010 at 09:07, Stefan Bachert <[email protected]> wrote:
>>
>> Ok, let's go into details.
>>
>> I want to create a macro which build a <select> with its <option> tag.
>> Let call them {{buildSelect values=.. /}}
>> For the option items I need a list of string values
>> calling
>> {{buildSelect values=["a","b","c"] /}}
>> does not work. Display values in the macro just shows "[".
>
> You need to escape " because it's part of the macro parameter syntax.
>
> {{buildSelect values=[~"a~",~"b~",~"c~"] /}}
>
> But are you sure you need " characters ?
>
> {{buildSelect values=a,b,c /}} should be enough
The normalized syntax is {{buildSelect values="a,b,c"/}}
If you don't put the quotes around parameter values they are added
automatically for you. That's why you'd get the following:
{{buildSelect values="["a","b","c"]"/}}
And this explains why you need to escape the quotes if you use them inside a
parameter value.
Right now AFAIK only strings are supported as parameter type when the macro is
used in wiki syntax.
Thanks
-Vincent
>
> Unless you want to interpret this string as velocity code in a wiki
> macro but it seems very dangerous (a user could put any velocity he
> wants as parameter of your macro).
>
>>
>> OK, there is a workaround. Passing a string
>>
>> {{buildSelect values=["a|b|c"] /}}
>> and applying $util.split works
>>
>> I guess this is a bug.
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users