render

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Variables = map[string]any{}

Functions

func GetEmoji

func GetEmoji(cat string) string

GetEmoji returns the corresponding emoji from the supplied category.

func HtmlTemplate

func HtmlTemplate(object any, recipe string) (any, error)

HtmlTemplate returns the corresponding html string from a supplied object and recipe template.

It also returns any errors encountered.

func Init

func Init()

Init initializes the T struct. It always starts by unmarshalling the "default" theme, then checks the user's supplied theme.

It also initializes the Variables map with the corresponding colors and render functions.

func Render

func Render(key string, aux map[string]any) (string, error)

Render returns the rendered string of the supplied key with the supplied variables and any error encountered.

func TextTemplate

func TextTemplate(object any, recipe string) (string, error)

TextTemplate returns the corresponding rendered string from a supplied object and recipe template.

It also returns any errors encountered.

Types

type Icon

type Icon struct {
	Light, Dark string
}

func GetIcon

func GetIcon(cat string) Icon

GetIcon returns the corresponding Icon from the supplied category.

type Model

type Model struct {
	Title struct {
		Up       string `yaml:"up"`
		Left     string `yaml:"left"`
		Right    string `yaml:"right"`
		Down     string `yaml:"down"`
		Centered bool   `yaml:"centered"`
	} `yaml:"title"`
	Check struct {
		Info string `yaml:"info"`
		Name struct {
			Failed string `yaml:"failed"`
			Ok     string `yaml:"ok"`
		} `yaml:"title"`
	} `yaml:"check"`
	Checkbox struct {
		Failed string `yaml:"failed"`
		Ok     string `yaml:"ok"`
	} `yaml:"checkbox"`
	File struct {
		Call   string `yaml:"call"`
		Indent string `yaml:"indent"`
		Pad    string `yaml:"pad"`
	} `yaml:"file"`
	Pair     string `yaml:"pair"`
	Question string `yaml:"question"`
	Table    string `yaml:"table"`
}

type Theme

type Theme struct {
	Statistics string                       `yaml:"statistics"`
	Emojis     map[string]string            `yaml:"emojis"`
	Css        string                       `yaml:"css"`
	Icons      map[string]map[string]string `yaml:"icons"`
	HTML       *Model                       `yaml:"html"`
	Markdown   *Model                       `yaml:"markdown"`
	Obsidian   string                       `yaml:"obsidian"`
	Render     *Model                       `yaml:"render"`
}
var T *Theme

Jump to

Keyboard shortcuts

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