site

package
v0.0.0-...-7ffc71e Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationName

func ApplicationName(s string) option

func FromConfig

func FromConfig(newConfig *Config) option

func ServeConfig

func ServeConfig(s *Site) http.HandlerFunc

ServeConfig is an an http handler for serving the config struct

func SitePath

func SitePath(s string) option

func TmpDir

func TmpDir(s string) option

func UpdateConfig

func UpdateConfig(s *Site) http.HandlerFunc

UpdateConfig is a handler for updating the config

Types

type Config

type Config struct {
	SitePath        string `json:"sitePath,omitempty"`
	TmpDir          string `json:"tmpDir,omitempty"`
	ApplicationName string `json:"applicationName,omitempty"`
	ConfigFilePath  string `json:"configFilePath,omitempty"`
	GitPath         string `json:"gitPath,omitempty"`
	CanEdit         bool   `json:"canEdit"`
}

Config provides a structure for running a markdown wiki site

func DecodeConfig

func DecodeConfig(path string) (*Config, error)

DecodeConfig deserializes a byte array to a site

func (*Config) Merge

func (c *Config) Merge(newConfig *Config)

Merge overwrites config values from the new config object

func (*Config) String

func (c *Config) String() string

type Site

type Site struct {
	Config     *Config
	Pages      map[string]*context.Page
	ConfigPath string
	CanPublish bool
}

Site retains the application state

func New

func New(opts ...option) *Site

New will create a site state object

func (*Site) FetchPage

func (s *Site) FetchPage(p string) (*context.Page, error)

FetchPage will return the page, or fetch it and store it on the site

func (*Site) FetchPages

func (s *Site) FetchPages() error

FetchPages updates the state of the site :)

func (*Site) UpsertPage

func (s *Site) UpsertPage(path string, content string) (*context.Page, error)

UpsertPage is a function for helping the user update or create a page

Jump to

Keyboard shortcuts

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