page

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package page implements page parsing and generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTemplates

func ParseTemplates(tpl *template.Template, tpls []string) (*template.Template, error)

ParseTemplates parses tpls into a tpl, returning it back or an error.

func Template

func Template() *template.Template

Template returns a *template.Template that is used for generating pages.

Types

type Page

type Page struct {
	URI         string            `yaml:"uri"`
	Content     string            `yaml:"-"`
	Title       string            `yaml:"title"`
	Description string            `yaml:"description"`
	MetaTags    map[string]string `yaml:"meta_tags"`
	Template    string            `yaml:"template"`
}

Page represents a page.

func Parse

func Parse(tpl *template.Template, src string) (*Page, error)

Parse parses a file and returns Page or an error.

func (*Page) Generate

func (p *Page) Generate(tpl *template.Template, dst string) (err error)

Generate generates HTML from a Page and writes it to the file by the path dst, returning an error otherwise.

Jump to

Keyboard shortcuts

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