A good trick to see exactly what happen is tu put
wiki=false in your
velocity macro so that you see the exact result of velocity execution.
On Mon, Dec 20, 2010 at 16:18, Gerritjan Koekkoek
<gerritjankoekkoek(a)gmail.com> wrote:
Thx,
The Inline versus Block makes sense.
It fixes almost my problem
The \div versus /div was a typo, not really creating the macro error. It just displayed
the <\div> statement
So now the macro seems to work with one strange problem...
I call the macro in a foreach statement.
It fails the first loop; displaying the same error!
The second and all the other loops (32) present the result i want
So I called the macro before I enter the loop once, now the loop woks fine.
But the macro error on the initial call keeps coming.
Is it because these empty-line block seperator
So now my macro looks like;
#macro(ShowFlag $CountryCode)
#set($ImageExtension = '.png')
#set($CountryCodeFile = $CountryCode + $ImageExtension)
{{html clean="true"}}
<div class="flags">
<img
src="../../download/CdLSAssociations/FlagAttachments/$CountryCodeFile"
alt="$CountryCode"
title="$CountryCode"/>
</div>
{{/html}}
#end
Note I only needed one preceeding empty-line.
Marius suggested one-way-of-doing; what are other ways?
Gerritjan
Op 20 dec 2010, om 15:12 heeft Marius Dumitru Florea het volgende geschreven:
> Hi Gerritjan,
>
> On 12/20/2010 03:21 PM, Le GĂ©nie wrote:
>> Hi,
>>
>> I don't know if it is the answer but in your copie of the code, you type
>> <\div> in place of</div>.
>>
>> Regards,
>> Maxime
>>
>> 2010/12/20 Gerritjan Koekkoek<gerritjankoekkoek(a)gmail.com>
>>
>>> Hi
>>> I get this error (Failed to execute the [html] macro) if I change the
>>> following:
>>>
>>> #macro(ShowFlag $CountryCode)
>>> #set($ImageExtension = '.png')
>>> #set($CountryCodeFile = $CountryCode + $ImageExtension)
>>> {{html}}
>>> <img
>>>
src="../../download/CdLSAssociations/FlagAttachments/$CountryCodeFile"
>>> alt="$CountryCode"
>>> title="$CountryCode"/>
>>> {{/html}}
>>> #end
>>>
>>> to this
>>>
>>> #macro(ShowFlag $CountryCode)
>>> #set($ImageExtension = '.png')
>>> #set($CountryCodeFile = $CountryCode + $ImageExtension)
>
>>> {{html clean="true"}}
>
> clean=true by default so you don't need it.
>
>>> <div class="flags">
>>> <img
>>>
src="../../download/CdLSAssociations/FlagAttachments/$CountryCodeFile"
>>> alt="$CountryCode"
>>> title="$CountryCode"/>
>>> <\div>
>>> {{/html}}
>>> #end
>>>
>
>>> Why does adding the<div class...> and</div> give this error?
>
> The HTML macro was generating in-line content (just an IMG tag) and now,
> due to your change, it generates block level content (DIV is a block
> level HTML element). You have to make sure the HTML macro is not called
> in an in-line context. One way to do this is to add an empty line before
> and after it (the empty line is a block separator in xwiki/2.0 syntax).
>
> Hope this helps,
> Marius
>
>>>
>>> Gerritjan
>>> _______________________________________________
>>> users mailing list
>>> users(a)xwiki.org
>>>
http://lists.xwiki.org/mailman/listinfo/users
>>>
>> _______________________________________________
>> users mailing list
>> users(a)xwiki.org
>>
http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> users(a)xwiki.org
>
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne
_______________________________________________
users mailing list
users(a)xwiki.org