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

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Labels:
      None
    • Difficulty:
      Unknown
    • Similar issues:

      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

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

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response: