textwire

package module
v2.5.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 16 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

Neovim and VSCode Support

If you use Neovim or VSCode as your primary editor, you can install the Neovim Plugin or VSCode 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 Configure added in v2.2.0

func Configure(opt *config.Config)

func EvaluateFile

func EvaluateFile(absPath string, data map[string]any) (string, error)

func EvaluateString

func EvaluateString(inp string, data map[string]any) (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]any) error

func (*Template) String

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

Directories

Path Synopsis
lsp
textwire
example command

Jump to

Keyboard shortcuts

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