0.1.0 • Published 5 years ago

@simple-languages/template v0.1.0

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

.template

Installation

yarn add @simple-languages/template
// or
npm install @simple-languages/template
// or
<script src="https://unpkg.com/@simple-languages/template"></script>

Usage

import Template from "@simple-languages/template"
// or
const Template = require("@simple-languages/template")

Rendering

Template.render("{{ [1, 2, 3] }}") // => [1, 2, 3]

Parsing

Template.parse("hello {{ "dorian" | capitalize }}")

Examples

<p>{{ "hello " | plus "world" }}</p>
{% for user in users %}
  {{ user.name }}
{% endfor %}
{% if user.admin %}
  {{ "delete everything" | link_to "/secret/button" }}
{% endif %}
<p>
  hi {{ user.name }}
</p>

<p>
  welcome to the {{ repo.name }} repository, you might want to check out
  those other projects:
</p>

<ul>
  {% for project in projects %}
    {% unless project.fork %}
      <li>
        <a href="{{ project.url }}">
          {{ project.name }}
        </a>
      </li>
    {% endunless %}
  {% endfor %}
</ul>

<p>
  thanks for reading this on a {{ "now" | date "%A" | downcase }}
</p>
hello {{ user.name | capitalize }}

{% for todo in user.todos %}
  {{ todo.done | true_false "DONE" "TODO" }}
  {{ todo.name }}

  {% now = "now" | to_date %}
  {% if todo.due_date | and (todo.due_date | to_date | more_than now) %}
    due by {{ todo.due_date | to_date "short" }}
  {% endif %}
{% endfor %}
0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago