Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-4591

In a velocity macro, an optional parameter receives an old value even if left empty.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • None
    • 2.1
    • None
    • Unknown

    Description

      Sorry for messing up the format. Try again:

      Reproduce step:
      1. Create a velocity macro "lightbox" with two parameters - image(required), width(optional).
      !{!{velocity}}
      #set($image=$xcontext.macro.params.image)
      #set($width=$xcontext.macro.params.width)
      !{!{html}}
      <img src="$doc.getAttachmentURL($image)" width="$width"/>
      !{!

      {/html}

      !{!{/velocity}}

      2. Write a page with two such macros:
      !{!{lightbox img="aaa.jpg" width="300" /}}
      !{!{lightbox img="bbb.jpg" /}}

      3. Problem: The second lightbox still receive width="300", despite the fact that width is not defined.

      Attachments

        Issue Links

          Activity

            People

              sdumitriu Sergiu Dumitriu
              simba ZhaolinFeng
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: