util

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: GPL-3.0 Imports: 6 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 file structure.

func EnsureDir

func EnsureDir(dirName string) error

Ensure a directory exists

func GetFileBase

func GetFileBase(f string) string

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

func GetNavCrumbs added in v1.1.1

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

If link is "/a/b/c/file.md"

crumbs is {"a", "b", "c"}

crumbLinks is {"/a/index.html", "/a/b/index.html", "a/b/c/index.html"}

func IsEntryPresent

func IsEntryPresent(f string) (bool, error)

Check for markdown files under directory

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 RemoveHiddenFiles added in v1.1.1

func RemoveHiddenFiles(inDir string, files []string) []string

Remove hidden files from slice of files

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 inDir/a/b/c/file.md -> a/b/c/file

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