Velocity
  1. Velocity
  2. VELOCITY-616

Escaping of directives does not work if the directive is in curly brackets

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None

      Description

      To escape a directive, one must precede it with an escape backslash. According to the documentation:
      #if ($foo)
      \$bar
      #end
      Should render as
      #if $foo)
      $bar
      #end
      And it does.
      However, if you enclose the directive in curly brackets, the escape is ignored:
      #

      {if}

      ($foo)
      \$bar
      #

      {end}

      Ignores the escape and evaluates to
      \
      (assuming $foo is false).

        Activity

        Hide
        Nathan Bubna added a comment -

        Not major, as this feature was new to 1.5 and there are multiple ways to workaround. Still, would be good to fix for 1.6. Appears to be a parser bug...

        Show
        Nathan Bubna added a comment - Not major, as this feature was new to 1.5 and there are multiple ways to workaround. Still, would be good to fix for 1.6. Appears to be a parser bug...
        Hide
        Nathan Bubna added a comment -

        Test case showing this happens with both the built-in #if and the plugged in #foreach.

        Show
        Nathan Bubna added a comment - Test case showing this happens with both the built-in #if and the plugged in #foreach.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development