templater

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package templater provides functionality to manage and render templates for Zettelkasten notes.

Index

Constants

This section is empty.

Variables

View Source
var AvailableTemplates = map[string]bool{
	"day":      true,
	"roadmap":  true,
	"zet":      true,
	"project":  true,
	"feature":  true,
	"stack":    true,
	"question": true,
	"version":  true,
	"week":     true,
	"month":    true,
	"echo":     true,
	"sum":      true,
	"year":     true,
}

AvailableTemplates defines the set of templates that are available for use

Functions

This section is empty.

Types

type SingleTemplate

type SingleTemplate struct {
	FilePath string
	Content  string
	Data     TemplateData
}

type TemplateData

type TemplateData struct {
	Title     string
	Date      string
	Upstream  string
	Content   string
	Tags      []string
	Links     []string
	Fulfilled bool
}

TemplateData defines the structure for data that will be passed to templates during rendering.

type TemplateMap

type TemplateMap map[string]SingleTemplate

type Templater

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

Templater manages a collection of templates.

func NewTemplater

func NewTemplater() (*Templater, error)

func (*Templater) Execute

func (t *Templater) Execute(templateName string, data interface{}) (string, error)

Execute finds the template by name, validates the data against the expected struct, and renders the template.

func (*Templater) GenerateTagsAndDate

func (t *Templater) GenerateTagsAndDate(tmplName string) (string, []string)

GenerateTagsAndDate generates the Zettelkasten-style timestamp and auto-generated tags.

Jump to

Keyboard shortcuts

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