internal

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyStaticFiles

func CopyStaticFiles() error

func GetPagesPath

func GetPagesPath() (*[]string, error)

func LoadPages

func LoadPages() (*[]Page, error)

func NewContexts

func NewContexts(pages []Page) map[string]Context

func Serve

func Serve(watcherServer *WatcherServer, dir string, port int)

Serve built files

func WritePages

func WritePages(pages *[]Page) error

Types

type Context

type Context map[string]any

type Frontmatter

type Frontmatter map[string]any

type Page

type Page struct {
	SourceRelativePath string
	SourceAbsolutePath string
	Filename           string
	RelativeUrl        string
	Type               PageType

	Frontmatter *Frontmatter

	TemplateName *string
	Template     *Template

	Body   string // Rendered body, ready to be used in a template as Body
	Output string // Final output, ready to write to file
}

func NewPage

func NewPage(absolutePath string) (*Page, error)

func (*Page) Dump

func (p *Page) Dump()

func (*Page) Reload

func (p *Page) Reload() error

func (*Page) Render

func (p *Page) Render(contextMap map[string]Context) error

type PageType

type PageType int
const (
	Markdown PageType = iota
	TextTemplate
	Html
)

func (PageType) String

func (p PageType) String() string

type Project

type Project struct {
	Pages  []Page
	Assets []string
}

func NewProject

func NewProject() (*Project, error)

func (*Project) CopyStaticFiles

func (p *Project) CopyStaticFiles() error

func (*Project) ForceRebuild

func (p *Project) ForceRebuild() error

func (*Project) PurgeBuildDir

func (p *Project) PurgeBuildDir() error

func (*Project) WritePages

func (p *Project) WritePages() error

type Template

type Template struct {
	AbsolutePath string
	Filename     string

	Content string
}

func LoadTemplate

func LoadTemplate(root string, templateName string) (*Template, error)

type WatcherServer

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

func NewWatcherServer

func NewWatcherServer() *WatcherServer

func (*WatcherServer) AddClient

func (w *WatcherServer) AddClient(conn *websocket.Conn)

func (*WatcherServer) Broadcast

func (w *WatcherServer) Broadcast(message string)

func (*WatcherServer) RemoveClient

func (w *WatcherServer) RemoveClient(conn *websocket.Conn)

Jump to

Keyboard shortcuts

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