Git Product home page Git Product logo

Comments (5)

carolineschnapp avatar carolineschnapp commented on August 18, 2024

This would be needed to use the official jQuery template plugin in Liquid templates: http://api.jquery.com/category/plugins/templates

That plugin uses double curly braces for all its tags, except for the alias ${ output } which is a short version for:

{{= output }}

Adding a β€œraw” tag may also solve the problem we currently have with Assistly. Assistly lets us use Liquid in replies to customers. That means that design supporters cannot share code snippets in a reply. Anything that uses double curly braces is 'parsed'. We have to create a gist every time we want to share a code snippet with our customers. We cannot use square brackets and ask them to make the substitution. Well, we can, but... that's so painful: β€œIn the above code snippet you must change [[ to double { and ]] to double }.”

from liquid.

carolineschnapp avatar carolineschnapp commented on August 18, 2024

Just to be clear, the only place you can place a jQuery template is inside a .liquid template, hence the road block. A jQuery template looks like this:

 <script id="my-template"  type="text/x-jquery-tmpl">
   <li>
      <a href="${url}">
         <span class="title">${title}</span>
      </a>
   </li>
 </script>

It's a script tag, so it cannot be placed in a .js file.

As soon as you want to use logic in such template, you have to use the double curly braces notation: http://api.jquery.com/category/plugins/templates

I was thinking about modifying the plugin itself but it's hosted on a CDN and it is updated and improved constantly.

from liquid.

phaer avatar phaer commented on August 18, 2024

I'd love to see this feature. It would also help with mustache and other template languages beside jQuery.tmpl().

Because - according to "Liquid for Programmers" - Liquid parses all block tags, we'd have to patch liquid itself. A custom block tag itself can't help here.

from liquid.

phaer avatar phaer commented on August 18, 2024

Wrote a proof of concept which i'm using for my jekyll generated site: https://gist.github.com/1020852 . Should be trivial to include it in other projects.

from liquid.

phaer avatar phaer commented on August 18, 2024

Well, it seems like there is a little issue in this implementation: If you use {{ variable }} inside a html attribute it gets masked. For example:

<a href="#{{id}}">{{name}}</a>

becomes

<a href="#%7B%7Bid%7D%7D">Test</a>

I'll have a look into this during the next days.

from liquid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.