blog

package
v0.0.0-...-0a2ff85 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructPostLink(post Post) string

get the (sub-)link to the blog post

func ConstructRepoPostFilePath

func ConstructRepoPostFilePath(repoPath, postType, postTitle string) string

func GetFilepath

func GetFilepath(articleTitle, folderPath string) string

Types

type Article

type Article struct {
	Meta Metadata
	// contains filtered or unexported fields
}

func NewArticleWithBaseDir

func NewArticleWithBaseDir(meta Metadata, baseDir string) *Article

func (Article) Path

func (a Article) Path() string

func (Article) RepoFolder

func (a Article) RepoFolder() string

func (Article) Title

func (a Article) Title() string

func (Article) Write

func (a Article) Write(file io.Writer)

type BlogWriter

type BlogWriter struct {
	RepoPath string
	FS       Fs
}

func (*BlogWriter) AddMedia

func (b *BlogWriter) AddMedia(post Post, media io.Reader, filename string) error

func (*BlogWriter) EditNowPage

func (b *BlogWriter) EditNowPage() error

func (*BlogWriter) GetNowPath

func (b *BlogWriter) GetNowPath() string

func (BlogWriter) LinkInRepo

func (b BlogWriter) LinkInRepo(post Post) error

func (*BlogWriter) Write

func (b *BlogWriter) Write(post Post) error

type Book

type Book struct {
	TemplateFile io.Reader
	Meta         Metadata
	// contains filtered or unexported fields
}

func NewBookWithBaseDir

func NewBookWithBaseDir(meta Metadata, baseDir string) *Book

func (Book) Path

func (b Book) Path() string

func (Book) RepoFolder

func (b Book) RepoFolder() string

func (Book) Title

func (b Book) Title() string

func (Book) Write

func (b Book) Write(bookFile io.Writer)

type Fs

type Fs interface {
	FsSymLinker
	Create(name string) (afero.File, error)
	Open(name string) (afero.File, error)
}

type FsSymLinker

type FsSymLinker interface {
	Symlink(target, symlink string) error
	MkdirAll(path string, perm os.FileMode) error
}

type Letter

type Letter struct {
	TemplateFile io.Reader
	Meta         Metadata
	// contains filtered or unexported fields
}

func NewLetterWithBaseDir

func NewLetterWithBaseDir(meta Metadata, baseDir string) *Letter

func (Letter) Path

func (b Letter) Path() string

func (Letter) RepoFolder

func (b Letter) RepoFolder() string

func (Letter) Title

func (b Letter) Title() string

func (Letter) Write

func (a Letter) Write(file io.Writer)

type Metadata

type Metadata struct {
	Title      string
	Date       string
	Categories []string
}

func (Metadata) String

func (m Metadata) String() string

type Post

type Post interface {
	Title() string
	Write(file io.Writer)
	RepoFolder() string
	Path() string
}

type PostFactory

type PostFactory struct {
	BookTemplate io.Reader
	BaseDir      string
}

func (PostFactory) NewPost

func (f PostFactory) NewPost(meta Metadata) (post Post, err error)

Jump to

Keyboard shortcuts

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