Velocity
  1. Velocity
  2. VELOCITY-661

Parsing errors on content inside #literal() #end block

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.7
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      ALL

      Description

      I have some velocity templates that include quit some javascript. Inside the javascript a javascrip template engine is used which also uses $

      {varname}

      Escaping each occurance would make the code rather unreable, so to prevent velocity from parsing the javascript code, I put a #literal() around it.

      However, velocity still PARSES the contents of this block, which of course results in parsing exceptions.

      My feeling with "literal" is that it is completely UNINTERPRETED content?

      This SHOULD work:

      #literal()
      var myId = 'someID';
      $('#test).append($.template('<div id="$

      {myId}

      "></div>').apply(

      {myId: myId}

      ));
      #end

      1. velocity-661-v1.0.patch
        14 kB
        Jarkko Viinamäki

        Issue Links

          Activity

          Niki Driessen created issue -
          Nathan Bubna made changes -
          Field Original Value New Value
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          Jarkko Viinamäki made changes -
          Attachment velocity-661-v1.0.patch [ 12397023 ]
          Nathan Bubna made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 1.7 [ 12313453 ]
          Jarkko Viinamäki made changes -
          Link This issue is related to VELOCITY-584 [ VELOCITY-584 ]
          Mark Thomas made changes -
          Workflow jira [ 12449272 ] Default workflow, editable Closed status [ 12551607 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12551607 ] jira [ 12552491 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development