Velocity
  1. Velocity
  2. VELOCITY-698

If #stop is specified as #stop(template) then parsing only stops current template rendering

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.x
    • Fix Version/s: 1.7, 2.x
    • Component/s: Engine
    • Labels:
      None

      Description

      #stop(template) will only stop the current template, so if the template is called with a #parse command, then rendering will end within the given #parse, and resume within the calling template.

        Activity

        Hide
        Byron Foster added a comment -

        yea, no need for this anymore.

        Show
        Byron Foster added a comment - yea, no need for this anymore.
        Hide
        Nathan Bubna added a comment -

        The #stop(parse) is now gone from 2.0, but you can now do #break($template) in both 1.7 and 2.0 thanks to VELOCITY-704. So i think that closes out this issue, right?

        Show
        Nathan Bubna added a comment - The #stop(parse) is now gone from 2.0, but you can now do #break($template) in both 1.7 and 2.0 thanks to VELOCITY-704 . So i think that closes out this issue, right?
        Hide
        Byron Foster added a comment -

        'parse' is simply a keyword, a simple flag to instruct the #stop directive to end rendering up to the last #parse call, then continue rendering. Without this keyword template rendering ends regardless of the current #parse level.

        Show
        Byron Foster added a comment - 'parse' is simply a keyword, a simple flag to instruct the #stop directive to end rendering up to the last #parse call, then continue rendering. Without this keyword template rendering ends regardless of the current #parse level.
        Hide
        Claude Brisson added a comment -

        Could you just elaborate a bit on this new syntax? Do you mean: #stop('/mypath/mytemplate.vtl') ?
        If so, how does a vtl library writer know how his template will be called?
        Or literally "#stop(parse)" ? What is the behaviour on chained parses?

        Show
        Claude Brisson added a comment - Could you just elaborate a bit on this new syntax? Do you mean: #stop('/mypath/mytemplate.vtl') ? If so, how does a vtl library writer know how his template will be called? Or literally "#stop(parse)" ? What is the behaviour on chained parses?
        Hide
        Byron Foster added a comment -

        I actually implemented this as #stop(parse) which I think is more obvious to the user. Also, I converted the #stop command to a directive instead of an AST node following the approach that if it doesn't have to be in the parser it shouldn't be.

        Show
        Byron Foster added a comment - I actually implemented this as #stop(parse) which I think is more obvious to the user. Also, I converted the #stop command to a directive instead of an AST node following the approach that if it doesn't have to be in the parser it shouldn't be.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development