builder

package
v0.0.0-...-fa3d426 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mod

func Mod(a, b interface{}) int64

Mod returns modulo of given int values @todo Replace interface{}

func ModBool

func ModBool(a, b interface{}) bool

ModBool returns true if the modulo of given integers is zero

func RegisterNodeBuilder

func RegisterNodeBuilder(name string, initializer func(*SiteBuilder) NodeBuilder)

RegisterNodeBuilder registers a NodeBuilder

func StartsWith

func StartsWith(check string, prefix string) bool

StartsWith returns true if check has prefix.

Types

type ActivitiesBuilder

type ActivitiesBuilder struct {
	*NodeBuilderBase
	// contains filtered or unexported fields
}

ActivitiesBuilder builds activities page

func (*ActivitiesBuilder) Data

func (builder *ActivitiesBuilder) Data(name string) interface{}

Data is part of NodeBuilder interface

func (*ActivitiesBuilder) Load

func (builder *ActivitiesBuilder) Load()

Load is part of NodeBuilder interface

func (*ActivitiesBuilder) NewActivityVars

func (builder *ActivitiesBuilder) NewActivityVars(activity *models.Activity) *ActivityVars

NewActivityVars instanciates a new ActivityVars

type ActivitiesContent

type ActivitiesContent struct {
	Activities []*ActivityVars
}

ActivitiesContent represents activities node content

type ActivityVars

type ActivityVars struct {
	Date    time.Time
	Cover   *ImageVars
	Title   string
	Summary raymond.SafeString
	Body    raymond.SafeString
}

ActivityVars represents activity vars

type ContactBuilder

type ContactBuilder struct {
	*NodeBuilderBase
}

ContactBuilder builds contact page

func (*ContactBuilder) Load

func (builder *ContactBuilder) Load()

Load is part of NodeBuilder interface

func (*ContactBuilder) NewContactContent

func (builder *ContactBuilder) NewContactContent() *ContactContent

NewContactContent instanciates a new ContactContent

type ContactContent

type ContactContent struct {
	HaveContact bool
	Email       string
	Address     raymond.SafeString

	HaveSocial bool
	Facebook   string
	Twitter    string
	GooglePlus string
}

ContactContent represents a contact node content

type ErrorCollector

type ErrorCollector struct {
	Errors   map[string][]error
	ErrorsNb int
}

ErrorCollector holds a list of errors

func NewErrorCollector

func NewErrorCollector() *ErrorCollector

NewErrorCollector instanciates a new ErrorCollector

type EventContent

type EventContent struct {
	Model *models.Event

	Cover *ImageVars
	Title string
	Place string
	Body  raymond.SafeString
	Url   string

	Dates string

	StartDateRFC3339  string
	StartDateTime     string
	StartDate         string
	StartWeekday      string
	StartWeekdayShort string
	StartDay          string
	StartMonth        string
	StartMonthShort   string
	StartYear         string
	StartTime         string

	EndDateRFC3339  string
	EndDateTime     string
	EndDate         string
	EndWeekday      string
	EndWeekdayShort string
	EndDay          string
	EndMonth        string
	EndMonthShort   string
	EndYear         string
	EndTime         string
}

EventContent represents an event node content

type EventContentsByStartDate

type EventContentsByStartDate []*EventContent

EventContentsByStartDate represents sortable event node contents

func (EventContentsByStartDate) Len

func (events EventContentsByStartDate) Len() int

Implements sort.Interface

func (EventContentsByStartDate) Less

func (events EventContentsByStartDate) Less(i, j int) bool

Implements sort.Interface

func (EventContentsByStartDate) Swap

func (events EventContentsByStartDate) Swap(i, j int)

Implements sort.Interface

type EventsBuilder

type EventsBuilder struct {
	*NodeBuilderBase
	// contains filtered or unexported fields
}

EventsBuilder builds events pages

func (*EventsBuilder) Load

func (builder *EventsBuilder) Load()

Load is part of NodeBuilder interface

func (*EventsBuilder) NewEventContent

func (builder *EventsBuilder) NewEventContent(event *models.Event, node *Node) *EventContent

NewEventContent instanciates a new EventContent

type EventsContent

type EventsContent struct {
	Events     []*EventContent
	PastEvents []*EventContent
}

EventsContent represents events node content

type HomepageBuilder

type HomepageBuilder struct {
	*NodeBuilderBase
}

HomepageBuilder builds homepage

func (*HomepageBuilder) Load

func (builder *HomepageBuilder) Load()

Load is part of NodeBuilder interface

func (*HomepageBuilder) NewHomepageContent

func (builder *HomepageBuilder) NewHomepageContent(node *Node) *HomepageContent

NewHomepageContent instanciates a new homepage content

type HomepageContent

type HomepageContent struct {
	Description raymond.SafeString // Site description
	MoreDesc    raymond.SafeString // Site additional description
	JoinText    raymond.SafeString // Site join text
	Cover       *ImageVars         // Site cover

	Activities []*ActivityVars // Activities
}

HomepageContent represents homepage node content

type ImageVars

type ImageVars struct {
	Original             string
	OriginalAbsolute     string
	Thumb                string
	ThumbAbsolute        string
	Square               string
	SquareAbsolute       string
	Small                string
	SmallAbsolute        string
	SmallFill            string
	SmallFillAbsolute    string
	PortraitFill         string
	PortraitFillAbsolute string
	Large                string
	LargeAbsolute        string
}

ImageVars reprents an image variables

func NewImageVars

func NewImageVars(img *models.Image, basePath string, baseURL string) *ImageVars

NewImageVars instanciates a new ImageVars

type MemberVars

type MemberVars struct {
	Date        time.Time
	Photo       *ImageVars
	Fullname    string
	Role        string
	Description string
}

MemberVars reprsents member vars

type MembersBuilder

type MembersBuilder struct {
	*NodeBuilderBase
	// contains filtered or unexported fields
}

MembersBuilder builds members pages

func (*MembersBuilder) Data

func (builder *MembersBuilder) Data(name string) interface{}

Data is part of NodeBuilder interface

func (*MembersBuilder) Load

func (builder *MembersBuilder) Load()

Load is part of NodeBuilder interface

func (*MembersBuilder) NewMemberVars

func (builder *MembersBuilder) NewMemberVars(member *models.Member) *MemberVars

NewMemberVars instanciates a new MemberVars

type MembersContent

type MembersContent struct {
	Members []*MemberVars
}

MembersContent represents members node content

type NavBarItemsByOrder []*SiteNavBarItem

NavBarItemsByOrder holds an ordered list of navigation bar items

func (items NavBarItemsByOrder) Len() int

Implements sort.Interface

func (items NavBarItemsByOrder) Less(i, j int) bool

Implements sort.Interface

func (items NavBarItemsByOrder) Swap(i, j int)

Implements sort.Interface

type Node

type Node struct {
	// template vars
	Kind string
	Site *SiteVars

	Title   string
	Tagline string
	Cover   *ImageVars

	Meta        *NodeMeta
	BodyClass   string
	InNavBar    bool
	NavBarOrder int

	Slug        string // eg: 2015/03/17/my_post
	FilePath    string // eg: /2015/03/17/my_post/index.html
	Url         string // eg: /my_site/2015/03/17/my_post/
	AbsoluteUrl string // eg: http://127.0.0.1:48910/my_site/2015/03/17/my_post/

	Content interface{}
	// contains filtered or unexported fields
}

Node represents a node theme variables

func NewNode

func NewNode(builder NodeBuilder, kind string) *Node

NewNode instnciantes a new Node

type NodeBuilder

type NodeBuilder interface {
	// Returns site builder
	SiteBuilder() *SiteBuilder

	// Load all nodes
	Load()

	// Generate all nodes
	Generate() map[string]bool

	// Returns all loaded nodes
	Nodes() []*Node

	// Returns loaded nodes that must be placed in navigation bar
	NavBarNodes() []*Node

	// Returns given data
	Data(string) interface{}
}

NodeBuilder is the interface for node builders

func NewActivitiesBuilder

func NewActivitiesBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewActivitiesBuilder instanciates a new NodeBuilder

func NewContactBuilder

func NewContactBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewContactBuilder instanciates a new NodeBuilder

func NewEventsBuilder

func NewEventsBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewEventsBuilder instanciate a new NodeBuilder

func NewHomepageBuilder

func NewHomepageBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewHomepageBuilder instanciates a new NodeBuilder

func NewMembersBuilder

func NewMembersBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewMembersBuilder instanciates a new NodeBuilder

func NewPagesBuilder

func NewPagesBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewPagesBuilder instanciates a new NodeBuilder

func NewPostsBuilder

func NewPostsBuilder(siteBuilder *SiteBuilder) NodeBuilder

NewPostsBuilder instanciate a new NodeBuilder

type NodeBuilderBase

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

NodeBuilderBase is the node builder base

func (*NodeBuilderBase) Data

func (builder *NodeBuilderBase) Data(name string) interface{}

Data is part of NodeBuilder interface

func (*NodeBuilderBase) Generate

func (builder *NodeBuilderBase) Generate() map[string]bool

Generate is part of NodeBuilder interface

func (*NodeBuilderBase) Load

func (builder *NodeBuilderBase) Load()

Load is part of NodeBuilder interface

func (*NodeBuilderBase) NavBarNodes

func (builder *NodeBuilderBase) NavBarNodes() []*Node

NavBarNodes is part of NodeBuilder interface

func (*NodeBuilderBase) Nodes

func (builder *NodeBuilderBase) Nodes() []*Node

Nodes is part of NodeBuilder interface

func (*NodeBuilderBase) SiteBuilder

func (builder *NodeBuilderBase) SiteBuilder() *SiteBuilder

SiteBuilder is part of NodeBuilder interface

type NodeMeta

type NodeMeta struct {
	Title       string
	Description string
	ImageUrl    string

	Type        string
	TwitterCard string
}

NodeMeta represents node metadata

type PageContent

type PageContent struct {
	Model *models.Page

	Date  time.Time
	Cover *ImageVars
	Body  raymond.SafeString
	Url   string
}

PageContent represents a page node content

type PagesBuilder

type PagesBuilder struct {
	*NodeBuilderBase
}

PagesBuilder builds custom pages

func (*PagesBuilder) Load

func (builder *PagesBuilder) Load()

Load is part of NodeBuilder interface

func (*PagesBuilder) NewPageContent

func (builder *PagesBuilder) NewPageContent(page *models.Page, node *Node) *PageContent

NewPageContent instanciates a new PageContent

type PostContent

type PostContent struct {
	Model *models.Post

	Date  string
	Cover *ImageVars
	Title string
	Body  raymond.SafeString
	Url   string
}

PostContent represents a post node content

type PostsBuilder

type PostsBuilder struct {
	*NodeBuilderBase
	// contains filtered or unexported fields
}

PostsBuilder builds posts

func (*PostsBuilder) Load

func (builder *PostsBuilder) Load()

Load is part of NodeBuilder interface

func (*PostsBuilder) NewPostContent

func (builder *PostsBuilder) NewPostContent(post *models.Post, node *Node) *PostContent

NewPostContent instanciate a new PostContent

type PostsContent

type PostsContent struct {
	Posts []*PostContent
}

PostsContent represents the posts page content

type SiteBuilder

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

SiteBuilder builds an entire site

func NewSiteBuilder

func NewSiteBuilder(site *models.Site) *SiteBuilder

NewSiteBuilder instanciates a new SiteBuilder

func (*SiteBuilder) Build

func (builder *SiteBuilder) Build()

Build executes site building

func (*SiteBuilder) DumpErrors

func (builder *SiteBuilder) DumpErrors()

DumpErrors displays collected errors

func (*SiteBuilder) HaveError

func (builder *SiteBuilder) HaveError() bool

HaveError returns true if builder have error

func (*SiteBuilder) OutputDir

func (builder *SiteBuilder) OutputDir() string

OutputDir returns path to output directory

func (*SiteBuilder) Translate

func (site *SiteBuilder) Translate(sentence string) string

Translate translates given sentence.

func (*SiteBuilder) UrlFor

func (site *SiteBuilder) UrlFor(dest string) string

UrlFor returns an URL to an internal page.

type SiteNavBarItem struct {
	Url   string // Item URL
	Title string // Item title
	Order int    // Item order
}

SiteNavBarItem represents an item in navigation bar

func NewSiteNavBarItem

func NewSiteNavBarItem(url string, title string, order int) *SiteNavBarItem

NewSiteNavBarItem instanciates a new SiteNavBarItem

type SiteVars

type SiteVars struct {
	Name         string
	Tagline      string
	NameInNavBar bool
	Favicon      bool

	Membership string

	BaseUrl  string
	BasePath string

	Facebook   string
	Twitter    string
	GooglePlus string

	GoogleAnalytics string

	NavBar []*SiteNavBarItem // Navigation bar
	// contains filtered or unexported fields
}

SiteVars holds site theme variables

func NewSiteVars

func NewSiteVars(siteBuilder *SiteBuilder) *SiteVars

NewSiteVars instanciates a new SiteVars

Jump to

Keyboard shortcuts

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