view

package
v0.0.0-...-18492a3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugRender

type DebugRender struct {
	fs.FS
}

DebugRender like Render but reloads templates at every request For testing purposes only

func (*DebugRender) RenderPage

func (htmlRend *DebugRender) RenderPage(wr io.Writer, tplContext TemplateContext) error

RenderPage render page and writes data to wr. Reloads all templates every time

type EditorContext

type EditorContext struct {
	Title       string
	Msg         string
	InitialText string
}

EditorContext context for editor.html

func (*EditorContext) FileName

func (c *EditorContext) FileName() string

Name of the page

type HTMLPageView

type HTMLPageView interface {
	RenderPage(wr io.Writer, tplContext TemplateContext) error
}

HTMLPageView renders HTML pages from templates

func NewView

func NewView(filePath string) (HTMLPageView, error)

type OpenGraphInfo

type OpenGraphInfo struct {
	Title       string
	Type        string
	URL         string
	Image       string
	Description string
}

OpenGraphInfo contain Opengraph metadata

type PageContext

type PageContext struct {
	Title      string
	Body       template.HTML
	OgInfo     *OpenGraphInfo
	CreateTime string
	DocID      string
}

PageContext context for page.html

func (*PageContext) FileName

func (c *PageContext) FileName() string

Name of the page

type Render

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

Render contains set of templates and pre-rendered pages

func (*Render) RenderPage

func (htmlRend *Render) RenderPage(wr io.Writer, tplContext TemplateContext) error

RenderPage render page and writes data to wr

type StatusContext

type StatusContext struct {
	Title     string
	HeaderMsg string
	Msg       string
}

StatusContext context for status.html

func (*StatusContext) FileName

func (c *StatusContext) FileName() string

Name of the page

type TemplateContext

type TemplateContext interface {
	// FileName with template file to render
	FileName() string
}

TemplateContext provides context for template

Jump to

Keyboard shortcuts

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