templates

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationHeaderID = "notification/header"
	NotificationBodyID   = "notification/body"
)

Variables

This section is empty.

Functions

func FlagEmoji

func FlagEmoji(countryCode string) string

Types

type MarkupOption

type MarkupOption func(markup map[string]string)

func Bold

func Bold(open, close string) MarkupOption

func CodeBlock

func CodeBlock(open, close string) MarkupOption

func CodeInline

func CodeInline(open, close string) MarkupOption

type Option

type Option func(*options)

func Default

func Default(topts ...TemplateOption) Option

Default allows to modify default template options.

func PerTemplate

func PerTemplate(id string, topts ...TemplateOption) Option

PerTemplate allows to modify options for single templates by their id.

type Template

type Template interface {
	Execute(io.Writer, any) error
}

type TemplateOption

type TemplateOption func(*templateOptions)

func ExtraFunc

func ExtraFunc(name string, fn any) TemplateOption

func HTMLEscape

func HTMLEscape(b bool) TemplateOption

func Markup

func Markup(mopts ...MarkupOption) TemplateOption

func NewLine

func NewLine(b bool) TemplateOption

type Templates

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

func New

func New(domain string, opts ...Option) *Templates

func (*Templates) RenderNotification

func (t *Templates) RenderNotification(n *modules.Notification) (string, string, error)

func (*Templates) RenderResult

func (t *Templates) RenderResult(out any) (string, error)

RenderResult renders a service command output, picking the template by the output's concrete Go type.

Jump to

Keyboard shortcuts

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