Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

SearchPilot/terrapin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terrapin

Terrapin is a lightweight template language. It uses the [ply]](https://github.com/dabeaz/ply) libary to tokenise and parse.

To install

pip install terrapin

Usage

from terrapin.parser import Parser

template = 'Hello {{name}}'
context = {
	"name" : "bob"
}

terrapin = Parser()
output = terrapin.parse(template, context)
print(output)

Syntax

Terrapin supports the following

  • Variables from the context: {{variable}}
  • Truthy if {% if variable %}I'm alive{% endif %}
  • Equality if {% if variable == "String" %}I'm alive{% endif %}
  • Non Equality if {% if variable != "String" %}I'm alive{% endif %}
  • Else {% if variable %}foo{% else %}bar{% endif %}

About

Terrapin the templating language

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages