builder

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BasicTemplates embed.FS
View Source
var SetTemplates embed.FS
View Source
var WritingTemplates embed.FS

Functions

func CopyDir

func CopyDir(src, dst string)

func CopyFile

func CopyFile(src, dst string)

func Mkdir

func Mkdir(base, ext string)

func WriteWriting

func WriteWriting(website Website, writing Writinger, outputPath string, template *template.Template)

Types

type ElementPage

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

func (ElementPage) Name

func (s ElementPage) Name() string

func (ElementPage) Posts

func (s ElementPage) Posts() []PostWriting

func (ElementPage) Url

func (s ElementPage) Url() string

type PostWriting

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

PostWriting is an spectific struct for post that implements the Writinger interface. Its methods are the same in behavior as the Writing struct

func NewPostWriting

func NewPostWriting(post manager.Post, baseUrl string) PostWriting

func (PostWriting) RenderContent

func (pw PostWriting) RenderContent() string

func (PostWriting) RenderHeader

func (pw PostWriting) RenderHeader() string

func (PostWriting) RenderPartialContent

func (pw PostWriting) RenderPartialContent(n int) string

func (PostWriting) Url

func (pw PostWriting) Url() string

type PostWritingContext

type PostWritingContext struct {
	Writing PostWriting
	Website Website
}

type PostsPage

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

PostsPage stores info about the PostsPages which it belongs, index, a list of writings related to this PostsPage and its url.

func (PostsPage) Empty

func (p PostsPage) Empty() bool

Empty tells if this PostsPage is empty, does not belong to PostsPages.

func (PostsPage) HasLast

func (p PostsPage) HasLast() bool

HasLast returns true if this is not the last PostsPage.

func (PostsPage) HasNext

func (p PostsPage) HasNext() bool

HasNext returns true if there are more PostsPages.

func (PostsPage) Last

func (p PostsPage) Last() PostsPage

Last returns the last PostsPage on this PostsPage. Returns an empty PostsPage if not.

func (PostsPage) Next

func (p PostsPage) Next() PostsPage

Next returns the next PostsPage on this PostsPage. Returns an empty PostsPage if is not possible.

func (PostsPage) Url

func (p PostsPage) Url() string

Url returns the final url of this PostsPage.

func (PostsPage) Writings

func (p PostsPage) Writings() []PostWriting

Writinngs returns the writings stored in this PostsPage

type PostsPageContext

type PostsPageContext struct {
	CurrentPage PostsPage
	Website     Website
}

type PostsPages

type PostsPages []PostsPage

PostsPages is defined type for a slice of PostsPage.

func NewPostsPages

func NewPostsPages(postsPerPage int, posts []PostWriting, base string) PostsPages

type SetPageContext

type SetPageContext struct {
	ElementPage ElementPage
	Website     Website
}

type Website

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

Website represents a website with its posts PostsPage and PostsPage.

func NewWebsite

func NewWebsite(title string, postsPerPage int, posts []manager.Post, pages []manager.Page, content manager.Content) Website

NewWebsite returns info about the website.

func (Website) Categories

func (w Website) Categories() []ElementPage

func (Website) HasStyle

func (w Website) HasStyle() bool

func (Website) License

func (w Website) License() string

func (Website) Pages

func (w Website) Pages() []Writing

Pages returns its Pages.

func (Website) Posts

func (w Website) Posts() []PostWriting

Posts returns all the posts

func (Website) PostsPages

func (w Website) PostsPages() PostsPages

PostsPages returns its PostsPages.

func (*Website) SetStyle

func (w *Website) SetStyle(style string)

func (Website) Style

func (w Website) Style() string

func (Website) Title

func (w Website) Title() string

type Writing

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

Writing stores a copy of the manager.File and a final url of the post

func NewWriting

func NewWriting(file manager.Page, baseUrl string) Writing

NewWriting constructs a Writing value with a baseUrl to be used along with the the manager.File Name

func (Writing) File

func (w Writing) File() manager.Filer

func (Writing) RenderContent

func (w Writing) RenderContent() string

RenderContent returns HTML from a markdown format writing

func (Writing) RenderHeader

func (w Writing) RenderHeader() string

RenderHeader returns info about this file stored in the database to be used as a header

func (Writing) RenderPartialContent

func (w Writing) RenderPartialContent(n int) string

RenderPartialContent returns up to 'n' characters from the markdown file

func (Writing) Url

func (w Writing) Url() string

Url returns final writing URL

type WritingContext

type WritingContext struct {
	Writing Writing
	Website Website
}

type Writinger

type Writinger interface {
	RenderHeader() string
	RenderContent() string
	Url() string
	RenderPartialContent(int) string
}

Writinger is an interface for writable content like pages or posts

Jump to

Keyboard shortcuts

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