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

[patch] allow multi-line directives



    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5
    • 1.5
    • Engine
    • None
    • Operating System: other
      Platform: Other
    • 24338


      I'd like to allow all directives be able to stretch across multiple lines. An
      example might be:

      #set ($a =


      #if( $biglongreference ==
      "very big long string")

      The rationale for this is that newlines are sometimes silently inserted by web
      design applications into arbitrary HTML. For example, many of our users work
      with Macromedia DreamWeaver. DreamWeaver is not aware of VTL, and treats it
      like ordinary text. A user might type VTL in the "HTML" mode of DreamWeaver,
      only to see the VTL reformatted as paragraphed text after
      editing/saving/reloading. This means that a web page with VTL might work fine
      one day, and then break after the page is loaded/saved by the tool. This can
      be highly confusing, especially to the less technical template writers who
      might be using the web design program in the first place.

      In addition (although this is a less important reason), most scripting
      languages permit newlines within control statements.

      A couple of notes about this bug report and patch.

      (1) It's 100% backwards compatible, and passes "ant test"
      (2) The change is simple (despite the long patch). I simply replaced most
      references to <WHITESPACE> in Parser.jjt with <WHITESPACE_NEWLINE>
      (3) This is a completely separate issue from any debates over gobbling
      whitespace (Bug# 7940) or allowing multiline literals (Bug # 17803).
      (4) Whitespace gobbling rules at start/end of directive remain the same. (I
      think this should be addressed separately).


        1. ASF.LICENSE.NOT.GRANTED--multilinedirective.cmp
          0.0 kB
          Will Glass-Husain
        2. ASF.LICENSE.NOT.GRANTED--multilinedirective.vm
          0.1 kB
          Will Glass-Husain
        3. ASF.LICENSE.NOT.GRANTED--Parser.jjt.patch
          4 kB
          Will Glass-Husain
        4. ASF.LICENSE.NOT.GRANTED--test.patch
          0.5 kB
          Will Glass-Husain



            Unassigned Unassigned
            wglass@forio.com Will Glass-Husain
            0 Vote for this issue
            0 Start watching this issue