templates

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package templates provides plugins access to Go templates.

Configuration: |-----------------------|-----------------------| | Env | JSON | | ----------------------|-----------------------| | TEMPLATES_ALWAYSPARSE | templates.alwaysparse | | TEMPLATES_DIRS | templates.dirs | |-----------------------|-----------------------|

Index

Constants

View Source
const PluginName = "templates"

Constant name for identifying the templates plugin.

Variables

This section is empty.

Functions

This section is empty.

Types

type TemplateData

type TemplateData struct {
	Data   interface{}
	Config map[string]interface{}
}

type TemplatePlugin

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

TemplatePlugin exposes utilities for reading and rendering go templates.

func Plugin

func Plugin() *TemplatePlugin

Plugin returns a new TemplatePlugin.

func (*TemplatePlugin) Init

From prefab.InitializablePlugin.

func (*TemplatePlugin) Load

func (p *TemplatePlugin) Load(dirs []string) error

Load templates (*.tmpl) contained within the provided directory and all sub-directories.

func (*TemplatePlugin) Name

func (p *TemplatePlugin) Name() string

From prefab.Plugin.

func (*TemplatePlugin) Render

func (p *TemplatePlugin) Render(ctx context.Context, name string, data interface{}) (string, error)

Render a template.

Jump to

Keyboard shortcuts

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