Hi Thomas,

This is good help, thank you.
But still the fenomenon is the same; the first call to the macro fails with the 
same error message about inline

THe code looks like this;
{{include document="CdLSAssociations.Macros"/}}
{{velocity wiki=true}}
#set($attachments = $doc.attachmentList)

#ShowFlag("za" 30)

#foreach ($attach in $attachments)
  #set($tmpCountryCodeFileName = $attach.filename)
  #StripExtension($tmpCountryCodeFileName $FileNameWithoutExtension)
  #ShowFlag($FileNameWithoutExtension 30)
#end
{{/velocity}}

The macro that gives the error is ShowFlag

When I change the wiki=true for the macro to wiki=false the error dissappears
and the output is like (pretty much what I expect, there seems to be no inline 
problem???;
When i change false to true the first (south africa) will not display, but 
returns the error


{{html clean="true"}}

<div class="flags">
<img src="../../download/CdLSAssociations/FlagAttachments/za.png" 
alt="SOUTH AFRICA" 
title="SOUTH AFRICA"
height="30" 
width="30"/>
</div>

{{/html}}


{{html clean="true"}}

<div class="flags">
<img src="../../download/CdLSAssociations/FlagAttachments/au.png" 
alt="AUSTRALIA" 
title="AUSTRALIA"
height="30" 
width="30"/>
</div>

{{/html}}

{{html clean="true"}}

<div class="flags">
<img src="../../download/CdLSAssociations/FlagAttachments/ar.png" 
alt="ARGENTINA" 
title="ARGENTINA"
height="30" 
width="30"/>
</div>

{{/html}} 

Op 21 dec 2010, om 16:23 heeft Thomas Mortagne het volgende geschreven:

> 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
> <gerritjankoekk...@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<gerritjankoekk...@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@xwiki.org
>>>>> http://lists.xwiki.org/mailman/listinfo/users
>>>>> 
>>>> _______________________________________________
>>>> users mailing list
>>>> users@xwiki.org
>>>> http://lists.xwiki.org/mailman/listinfo/users
>>> _______________________________________________
>>> users mailing list
>>> users@xwiki.org
>>> http://lists.xwiki.org/mailman/listinfo/users
>> 
>> _______________________________________________
>> users mailing list
>> users@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/users
>> 
> 
> 
> 
> -- 
> Thomas Mortagne
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users

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

Reply via email to