pkg

package
v0.0.0-...-2bd3043 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(file string)

Main Build function.

func Check

func Check(err error)

Check

func ExtractData

func ExtractData(payload string, data Data) (string, error)

Gets a specific datapoint (home.title) from data.

func Help

func Help()

func Init

func Init()

func ProcessContent

func ProcessContent(template string, content string) string

Apply content to a template.

func ProcessData

func ProcessData(template string, data Data) string

Apply data to a template.

func ProcessPartials

func ProcessPartials(template string, partials map[string]string) string

Apply partials to a template.

func Serve

func Serve(file string, port string)

func WriteCollection

func WriteCollection(c Collection, config Config, globalData Data) error

Write collection to dir.

func WritePage

func WritePage(page Page, config Config, globalData Data)

Write page to file.

Types

type Collection

type Collection struct {
	Title    string
	Path     string
	Template string
	Data     map[string]string
	Posts    string
}

Collection struct. For each in collections.

type Config

type Config struct {
	Name        string
	Output      string
	Draft       bool
	Static_src  string
	Static_dest string
	Global      map[string]string
	Partials    map[string]string
	Pages       []Page
	Collections []Collection
}

Config struct. Built from site.yaml.

func ParseConfig

func ParseConfig(file string) Config

Parse them site.yaml file to get site Config.

type Data

type Data interface {
	// contains filtered or unexported methods
}

Data interface - built from YAML data files.

func CastData

func CastData(m map[interface{}]interface{}) (Data, error)

Cast a generic unmarshal to the Data format above.

func ExtractList

func ExtractList(payload string, data Data) ([]Data, error)

Gets a specific DataList from data.

func GetData

func GetData(m map[string]string) Data

Converts a map of data sources to the format above.

func GetDataFromFile

func GetDataFromFile(filename string) Data

Gets data from a file in the format above.

type DataLeaf

type DataLeaf string

DataLeaf - means there is no more data below.

type DataList

type DataList []Data

DataLeaf - means there is no more data below.

type DataNode

type DataNode map[string]Data

DataNode - means there is more data below.

type GenericError

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

Generic Error

func (GenericError) Error

func (b GenericError) Error() string

type Match

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

Match struct - specifies what should be replaced.

type Page

type Page struct {
	Title    string
	Path     string
	Template string
	Data     map[string]string
}

Page struct. For each in pages.

Jump to

Keyboard shortcuts

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