util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyExtraFiles

func CopyExtraFiles(inDir string, outDir string, files map[string]bool) error

Move extra files like assets (images, fonts, css) over to output, preserving the structure.

func EnsureDir

func EnsureDir(dirName string) error

Ensure directory exists

func GetCrumbs

func GetCrumbs(f string, inDir string, isExt bool) ([]string, []string)

If link is "/foo/bar/hello.md"

crumbs is {"foo", "bar"}

crumbLinks is {"/foo", "/foo/bar"}

func GetDepth

func GetDepth(dir string) int

Get the nesting-depth of a filepath

func GetFileBase

func GetFileBase(f string) string

Given /path/to/filename.ext, return filename

func GetFileExt

func GetFileExt(f string) string

Given /path/to/filename.ext, return .ext

func GetFileName

func GetFileName(f string) string

Given /path/to/filename.ext, return filename.ext

func GetFilePath

func GetFilePath(f string) string

Given /path/to/filename.ext, return /path/to

func GetRelativeFilePath

func GetRelativeFilePath(f string, root string) string

Given /abs/path/to/fileOrDir, where root is /abs/path, return to/fileOrDir

func IsEntryPresent

func IsEntryPresent(f string) (bool, error)

func IsFileExist

func IsFileExist(f string) (bool, error)

Return true/false if a path exists/doesn't exist

func RemoveContents

func RemoveContents(contents []string) error

OS delete given files

func RemoveExtension

func RemoveExtension(f string) string

Given filename.ext, return filename

func ReorderFiles

func ReorderFiles(files []string) []string

Move all index.md from files to the end so they are processed last

func ResolveDate

func ResolveDate(d string) (string, string, error)

Resolve the date d from format YYYY-MM-DD Returns a pretty date and a machine date

func ResolveHref

func ResolveHref(f string, inDir string, prefixSlash bool) string

Return the href

func ResolveOutPath

func ResolveOutPath(f string, inDir string, outDir string, newExt string) string

Resolve out path of file or directory given absolute path f

func ResolveTitle

func ResolveTitle(mt string, fn string) string

Return title mt else fn

Types

This section is empty.

Jump to

Keyboard shortcuts

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