render

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTemplateFS

func LoadTemplateFS(_fs fs.FS, baseDir string, patterns ...string) (*template.Template, error)

LoadTemplateFS will load a template from a fs.FS.

func NewDataTablesCreateProcessorFunc

func NewDataTablesCreateProcessorFunc() (glazed.CreateProcessorFunc, error)

func NewTemplateLookupCreateProcessorFunc

func NewTemplateLookupCreateProcessorFunc(
	lookup TemplateLookup,
	templateName string,
) glazed.CreateProcessorFunc

NewTemplateLookupCreateProcessorFunc creates a CreateProcessorFunc based on a TemplateLookup and a template name.

func RenderMarkdownTemplateToHTML

func RenderMarkdownTemplateToHTML(t *template.Template, data interface{}) (string, error)

func RenderMarkdownToHTML

func RenderMarkdownToHTML(rendered string) (string, error)

Types

type HTMLTemplateOutputFormatter

type HTMLTemplateOutputFormatter struct {
	*table.OutputFormatter
	// contains filtered or unexported fields
}

HTMLTemplateOutputFormatter wraps a normal HTML table output formatter, and allows a template to be added in the back in the front.

func (*HTMLTemplateOutputFormatter) Output

func (H *HTMLTemplateOutputFormatter) Output() (string, error)

type HTMLTemplateOutputFormatterOption

type HTMLTemplateOutputFormatterOption func(*HTMLTemplateOutputFormatter)

func WithHTMLTemplateOutputFormatterData

func WithHTMLTemplateOutputFormatterData(data map[string]interface{}) HTMLTemplateOutputFormatterOption

type HTMLTemplateProcessor

type HTMLTemplateProcessor struct {
	*cmds.GlazeProcessor
	// contains filtered or unexported fields
}

func (*HTMLTemplateProcessor) OutputFormatter

func (H *HTMLTemplateProcessor) OutputFormatter() formatters.OutputFormatter

type TemplateLookup

type TemplateLookup func(name ...string) (*template.Template, error)

TemplateLookup is a function that will lookup a template by name. It is use as an interface to allow different ways of loading templates to be provided to a parka application.

func LookupTemplateFromDirectory

func LookupTemplateFromDirectory(dir string) TemplateLookup

LookupTemplateFromDirectory will load a template at runtime. This is useful for testing local changes to templates without having to recompile the app.

func LookupTemplateFromFS

func LookupTemplateFromFS(_fs fs.FS, baseDir string, patterns ...string) (TemplateLookup, error)

LookupTemplateFromFS will load a template from a fs.FS.

NOTE: this loads the entire template directory into memory at startup. Files modified later on won't be refreshed. If you want to reload the entire directory on each template lookup, use LookupTemplateFromFSReloadable.

func LookupTemplateFromFSReloadable

func LookupTemplateFromFSReloadable(_fs fs.FS, baseDir string, patterns ...string) (TemplateLookup, error)

LookupTemplateFromFSReloadable will load a template from a fs.FS.

NOTE: this loads the entire template directory into memory on every lookup. This is not great for performance, but it is useful for development.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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