Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-686

BlockMacro renders $bodyContent on #set

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7
    • Component/s: Engine
    • Labels:
      None

      Description

      Given the following VTL:

      #macro(foo)#set($x = $bodyContent)#end
      #@foo()bar#end

      renders to:

      bar

      I wonder about calling render on JJTBLOCK types in the ProxyVMContext get method. Do you think it would be better in ASTReference render?

      There is an interesting use case for BlockMacros which looks something like this:

      #macro(escXML)$tool.escXml($bodyContent)#end

      The above definition could be used to create a filter like the following:

      #@escXML

        1. ... rendered stuff to be escaped
          #end

      $tool.escXml can intercept the writer and create a filter. But as it stands referencing $bodyContent renders the content making this use case impractical.

        Attachments

        1. velocity-686.patch
          12 kB
          Jarkko Viinamäki

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              byronvf Byron Foster
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: