post

package
v0.0.0-...-c64cc62 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Written uint

Written count the number of file written

Functions

func ConvertExt

func ConvertExt(file string, ext string) string

ConvertExt changes a file's extension to the given ext, for example "html".

func CreateHTMLFile

func CreateHTMLFile(publDir, postDir string, filePath *string) (file *os.File, err error)

CreateHTMLFile create an html file in the publDir that has the same path and name as the filepath input

func CreateIndex

func CreateIndex(conf *config.General, directory string) error

CreateIndex creates an index file in every directory, made for navigation purposes

func Execute

func Execute(conf *config.General) error

Execute is used to run the whole post making process TODO : Add more options to run and make it extensible

func GetFilename

func GetFilename(path string) string

GetFilename is used to retrieve the the filename of a file from a path, returns the extension too

func ListFiles

func ListFiles(dir string, withDir bool) (files []string, err error)

ListFiles list all files in a directory and subdirectories. Returns relative path of all files except those starting with a `.`

func MakePost

func MakePost(post string, wg *sync.WaitGroup, conf *config.General)

MakePost makes a post and inserts the content

func ParseTemplates

func ParseTemplates(TemplateDir string) (tpl *template.Template, err error)

ParseTemplates is used to parse all the templates inside the given directory

func TrimDir

func TrimDir(path, dir string) string

TrimDir trims the directory of the given path

func TrimFileExt

func TrimFileExt(path string) string

TrimFileExt returns the path without the fileExt

Types

type Index

type Index struct {
	FileTree []IndexTree
	Script   string
}

Index represent the templated Index file

type IndexTree

type IndexTree struct {
	FileURL   string
	FileTitle string
}

IndexTree represent each file present in the current directory by it's URL and name

func FileTree

func FileTree(f ...os.FileInfo) (tree []IndexTree)

FileTree returns an IndexTree based on a fileInfo array

type Post

type Post struct {
	Script    string
	PageTitle string
	Body      string
}

Post represent the templated file

Jump to

Keyboard shortcuts

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