textwire

package module
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 12 Imported by: 0

README

Textwire. A templating language for Go

Textwire is a simple yet powerful templating language for Go. It is designed to easily inject variables from Go code into a template file or just a regular string. It is inspired by Go's syntax and has a similar syntax to make it easier for Go developers to learn and use it.

Read Official Documentation

Installation

go get github.com/textwire/textwire/v2

VSCode Extension

If you use VSCode as your primary editor, you can install the Textwire extension to get syntax highlighting and other features for Textwire.

License

The Textwire project is licensed under the MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvaluateFile

func EvaluateFile(absPath string, data map[string]interface{}) (string, error)

func EvaluateString

func EvaluateString(inp string, data map[string]interface{}) (string, error)

func RegisterArrFunc

func RegisterArrFunc(name string, fn config.ArrayCustomFunc) error

func RegisterBoolFunc

func RegisterBoolFunc(name string, fn config.BoolCustomFunc) error

func RegisterFloatFunc

func RegisterFloatFunc(name string, fn config.FloatCustomFunc) error

func RegisterIntFunc

func RegisterIntFunc(name string, fn config.IntCustomFunc) error

func RegisterStrFunc

func RegisterStrFunc(name string, fn config.StrCustomFunc) error

Types

type Template

type Template struct {
	// contains filtered or unexported fields
}

func NewTemplate

func NewTemplate(opt *config.Config) (*Template, error)

func (*Template) Response

func (t *Template) Response(w http.ResponseWriter, filename string, data map[string]interface{}) error

func (*Template) String

func (t *Template) String(filename string, data map[string]interface{}) (string, *fail.Error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL