Documentation ¶
Index ¶
- func LoadTemplateFS(_fs fs.FS, baseDir string, patterns ...string) (*template.Template, error)
- func NewDataTablesCreateProcessorFunc() (glazed.CreateProcessorFunc, error)
- func NewTemplateLookupCreateProcessorFunc(lookup TemplateLookup, templateName string) glazed.CreateProcessorFunc
- func RenderMarkdownTemplateToHTML(t *template.Template, data interface{}) (string, error)
- func RenderMarkdownToHTML(rendered string) (string, error)
- type HTMLTemplateOutputFormatter
- type HTMLTemplateOutputFormatterOption
- type HTMLTemplateProcessor
- type TemplateLookup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTemplateFS ¶
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 RenderMarkdownToHTML ¶
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 NewHTMLTemplateOutputFormatter ¶
func NewHTMLTemplateOutputFormatter( t *template.Template, of *table.OutputFormatter, options ...HTMLTemplateOutputFormatterOption, ) *HTMLTemplateOutputFormatter
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 NewHTMLTemplateProcessor ¶
func NewHTMLTemplateProcessor( gp *cmds.GlazeProcessor, t *template.Template, options ...HTMLTemplateOutputFormatterOption, ) (*HTMLTemplateProcessor, error)
func (*HTMLTemplateProcessor) OutputFormatter ¶
func (H *HTMLTemplateProcessor) OutputFormatter() formatters.OutputFormatter
type TemplateLookup ¶
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 ¶
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.