Velocity
  1. Velocity
  2. VELOCITY-584

Change the #include directive ignore the SSI version of include

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.5
    • Fix Version/s: 2.x
    • Component/s: Engine
    • Labels:
      None

      Description

      When processing a file that happens to have the SSI version of 'include' in it, the velocity engine breaks.

      There are many cases where we end up with files that contain both, before they are cleaned up.

      <!-#include file="wisdom.inc"->

      Essentially, if it sees that syntax, it needs to ignore the include. A suggestion would be to check for any amount of whitespace after the #include, and then "file=". I don't think that will step on proper Velocity include syntax.

        Issue Links

          Activity

          Hide
          Jarkko Viinamäki added a comment -

          The new escaping syntax introduced in VELOCITY-661 now helps with this issue.

          Show
          Jarkko Viinamäki added a comment - The new escaping syntax introduced in VELOCITY-661 now helps with this issue.
          Hide
          Nathan Bubna added a comment -

          On further thought, we throw errors for any erroneous VTL. Stray #if, #foreach, or #end would also require some escaping work. I don't see any reason to be flexible with #include when we're not with the rest. Perhaps in 2.0?

          Show
          Nathan Bubna added a comment - On further thought, we throw errors for any erroneous VTL. Stray #if, #foreach, or #end would also require some escaping work. I don't see any reason to be flexible with #include when we're not with the rest. Perhaps in 2.0?
          Hide
          Nathan Bubna added a comment -

          Yeah, i don't like the idea of doing anything specific for SSIs, since Velocity is used much more broadly than that. But i think it would be fine if Velocity just ignored any #foo syntax that wasn't #else, #stop, or #end, since those are the only directives (and are very special ones) that don't need to be followed by a '('.

          I dunno how easy it would be to get the parser to do that, but i think it would be a good thing to do. The more "schmoo" that we ignore, the better (IMHO).

          Show
          Nathan Bubna added a comment - Yeah, i don't like the idea of doing anything specific for SSIs, since Velocity is used much more broadly than that. But i think it would be fine if Velocity just ignored any #foo syntax that wasn't #else, #stop, or #end, since those are the only directives (and are very special ones) that don't need to be followed by a '('. I dunno how easy it would be to get the parser to do that, but i think it would be a good thing to do. The more "schmoo" that we ignore, the better (IMHO).
          Hide
          Christopher Schultz added a comment -

          Since the built-in "include" directive requires parameters, maybe that could be the way to determine what Velocity does.

          Since #include requires an argument, any bare references to #include could be ignored because the reference doesn't "match" anything that exists in the directive or marco lookup table.

          This would be kind of like calling a method in a programming language without the right arguments in the right order. The default behavior for handling "inappropriate" directive or macro invocations would be to simply print out the original text (just like when we can't find an appropriate variable or other reference).

          I don't know if this is possible, but it sounds at least plausable.

          Show
          Christopher Schultz added a comment - Since the built-in "include" directive requires parameters, maybe that could be the way to determine what Velocity does. Since #include requires an argument, any bare references to #include could be ignored because the reference doesn't "match" anything that exists in the directive or marco lookup table. This would be kind of like calling a method in a programming language without the right arguments in the right order. The default behavior for handling "inappropriate" directive or macro invocations would be to simply print out the original text (just like when we can't find an appropriate variable or other reference). I don't know if this is possible, but it sounds at least plausable.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development