tmpl

package
v2.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package tmpl is used to parse Tamarin string templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragment

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

func (*Fragment) IsVariable

func (f *Fragment) IsVariable() bool

IsVariable returns true if this is an expression, false if it is raw text.

func (*Fragment) Value

func (f *Fragment) Value() string

Value returns the fragment text. If the fragment is an expression, this will the expression text without the ${} delimiters.

type Template

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

Template defines a string template which may contain any number of expressions within.

func Parse

func Parse(s string) (*Template, error)

Parse parses a string into a Template struct. The string may contain 0-N expressions in the form ${expression}.

func (*Template) Fragments

func (t *Template) Fragments() []*Fragment

Fragments returns the list of fragments that together form the entire template.

func (*Template) Value

func (t *Template) Value() string

Value returns the original string that defines the template.

Jump to

Keyboard shortcuts

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