render

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Render html according to html templates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(o string, t *template.Template, rd RenderData, isDry bool) error

Template html with data d.

func RenderAll

func RenderAll(
	d map[string]entry.Entry,
	l map[string][]listing.Listing,
	t []tag.Tag,
	inDir string,
	outDir string,
	tpl *template.Template,
	cfg *config.Config,
	files []string,
	isDry bool,
	skip map[string]bool,
) error

Render all files, including tags page, to html.

func RenderTags

func RenderTags(o string, t *template.Template, rd RenderData, isDry bool) error

Template tags page

Types

type RenderData

type RenderData struct {
	Body                                     template.HTML
	Head                                     template.HTML
	Title                                    string
	Description                              string
	Layout                                   string
	RootCrumb                                string
	Filename                                 string
	Date                                     string
	DateUpdated                              string
	MachineDate                              string
	MachineDateUpdated                       string
	Ext                                      string
	Tags                                     []string
	TagsListing                              []tag.Tag
	Footer                                   []config.FooterLink
	Backlinks, Relatedlinks, Crumbs, Listing []listing.Listing
	TOC                                      bool
	ShowHeader                               bool
}

All fields used in the html templates.

* Title: page title (set in title tags and in document)

* Description: body description

* Filename: has no extension. Used for navigation crumb.

func ConstructData

func ConstructData(
	cfg config.Config,
	entryData entry.Entry,
	listings []listing.Listing,
	cr []string,
	cl []string,
	filename string,
	isExt bool,
) (RenderData, error)

Recombine all the data from different places before rendering.

Jump to

Keyboard shortcuts

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