Git Product home page Git Product logo

dotliquid's Introduction

DotLiquid

DotLiquid tag on Stack Overflow AppVeyor build TravisCI build codecov NuGet Gitter

Maintainers wanted

Have you sent a PR to this repository? In that case, would you consider getting in touch with me so I can give you commit access to this repository? Please ping me at gitter/dotliquid or here on github.

What is this?

DotLiquid is a .Net port of the popular Ruby Liquid templating language. It is a separate project that aims to retain the same template syntax as the original, while using .NET coding conventions where possible.

For more information about the original Liquid project, see https://shopify.github.io/liquid/.

Quick start

  1. Download the latest release from the downloads page or NuGet. The zip file contains DotLiquid.dll, which is the only one you need.
  2. Read the docs for information on writing and using DotLiquid templates.

Why should I use DotLiquid?

  • You want to leave business logic in your compiled controllers and out of your templates.
  • You're looking for a logic-less template language that also exists for other platforms (ie: node, python).
  • You want to allow your users to edit their own page templates, but want to ensure they don't run insecure code.
  • You want to render templates directly from the database.
  • You want a template engine for emails.

What does it look like?

<ul id="products">
  {% for product in products %}
    <li>
      <h2>{{product.name}}</h2>
      Only {{product.price | price }}

      {{product.description | prettyprint | paragraph }}
    </li>
  {% endfor %}
</ul>

How to use DotLiquid

DotLiquid supports a very simple API based around the DotLiquid.Template class. Generally, you can read the contents of a file into a template, and then render the template by passing it parameters in the form of a Hash object. There are several ways you can construct a Hash object, including from a Dictionary, or using the Hash.FromAnonymousObject method.

Template template = Template.Parse("hi {{name}}"); // Parses and compiles the template
template.Render(Hash.FromAnonymousObject(new { name = "tobi" })); // => "hi tobi"

Projects using DotLiquid

Are you using DotLiquid in an open source project? Tell us with a PR!

dotliquid's People

Contributors

tbolon avatar daviburg avatar haf avatar mart-bogdan avatar rdumont avatar tgjones avatar bradphelan avatar rolandbaer avatar jyeohamilton avatar daveaglick avatar gregmac avatar tt avatar jogibear9988 avatar erikschierboom avatar mz1991 avatar dudes-come avatar miketaber avatar matthewrk avatar vitalragaz avatar grexican avatar boyawu10 avatar revcbh avatar anton-gogolev avatar mike9182 avatar patrykporabik avatar karpikpl avatar readmecritic avatar cyotek avatar fan711 avatar gitter-badger avatar

Watchers

James Cloos avatar

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.