textwire

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 11 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

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 added in v0.0.2

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

func EvaluateString added in v0.0.2

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

Types

type Config added in v0.0.2

type Config struct {
	// TemplateDir is the directory where the Textwire
	// templates are located. Default is "templates"
	TemplateDir string

	// TemplateExt is the extension of the Textwire
	// template files. Default is ".tw.html"
	TemplateExt string
	// contains filtered or unexported fields
}

Config is the main configuration for Textwire

type Template added in v0.0.2

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

func NewTemplate added in v0.0.2

func NewTemplate(c *Config) (*Template, error)

func (*Template) Response added in v0.0.2

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

func (*Template) String added in v0.0.2

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