Skip to content
/ stick Public
forked from tyler-sommer/stick

A golang port of the Twig templating engine

License

Notifications You must be signed in to change notification settings

mumnik/stick

 
 

Repository files navigation

Stick

Build Status GoDoc

A Go language port of the Twig templating engine.

Overview

This project is split over two main parts.

Package github.com/mumnik/stick is a Twig template parser and executor. It provides the core functionality and offers many of the same extension points as Twig like functions, filters, node visitors, etc.

Package github.com/mumnik/stick/twig contains extensions to provide the most Twig-like experience for template writers. It aims to feature the same functions, filters, etc. to be closely Twig-compatible.

Current status

Stable, mostly feature complete

Stick itself is mostly feature-complete, with the exception of whitespace control, and better error handling in places.

Stick is made up of three main parts: a lexer, a parser, and a template executor. Stick's lexer and parser are complete. Template execution is under development, but essentially complete.

See the to do list for additional information.

Installation

Stick is intended to be used as a library. The recommended way to install the library is using go get.

go get -u github.com/mumnik/stick

Usage

Execute a simple Stick template.

package main

import (
	"log"
	"os"
    
	"github.com/mumnik/stick"
)

func main() {
	env := stick.New(nil)
	if err := env.Execute("Hello, {{ name }}!", os.Stdout, map[string]stick.Value{"name": "Tyler"}); err != nil {
		log.Fatal(err)
	}
}

See godoc for more information.

To do

Further

About

A golang port of the Twig templating engine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%