Velocity
  1. Velocity
  2. VELOCITY-558

Allow macros that act as blockDirectives

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Windows

      Description

      Currently migrating a web project from Oracle's proprietary UIX to Velocity, I found the limitation that macros are always line directives and cannot ave content somewhat limiting.

      I would suggest the following improvement or addition to the macro functionality.

      You should be able to define a blockMacro - maybe with a syntax like this:

      #blockmacro(section $title $open)
      <table><th><td>$title</td></th>
      #if($open)
      #body
      #end
      </table>
      #end

      Where #body would render the body of the macro call. The macro call could look like this:

      #section("My Collapsible Section", true)
      <tr><td>sectionContent</td></tr>
      #end

      This allows the macro to render the content only under a certain condition, or it would allow the macro to render the content multiple times. I think this would a lot of flexibilty to macros - it might be an enhancement worth considering for the Summer of Code Google project.

        Issue Links

          Activity

          Hide
          Will Glass-Husain added a comment -

          Nice idea – thanks for suggesting it. (and good example).

          I think something similar is already in JIRA but couldn't find it. Somewhat related to VELOCITY-174.

          Show
          Will Glass-Husain added a comment - Nice idea – thanks for suggesting it. (and good example). I think something similar is already in JIRA but couldn't find it. Somewhat related to VELOCITY-174 .
          Hide
          Jarkko Viinamäki added a comment -

          This looks a lot like VELOCITY-583

          Show
          Jarkko Viinamäki added a comment - This looks a lot like VELOCITY-583
          Hide
          Nathan Bubna added a comment -

          Yep. Since VELOCITY-583 has a patch, let's favor that and close this.

          Show
          Nathan Bubna added a comment - Yep. Since VELOCITY-583 has a patch, let's favor that and close this.

            People

            • Assignee:
              Unassigned
              Reporter:
              Guido Deinhammer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development