Documentation ¶
Index ¶
- func ApplyToHTMLText(doc []byte, fn func(string) string) []byte
- func CopyFileContents(dst, src string, perm os.FileMode) error
- func FilenameDate(s string) (t time.Time, title string, found bool)
- func FollowDots(data interface{}, props []string) (interface{}, error)
- func IsNotEmpty(err error) bool
- func LeftPad(s string, n int) string
- func MatchList(patterns []string, name string) bool
- func MergeStringMaps(ms ...map[string]interface{}) map[string]interface{}
- func MustAbs(path string) string
- func MustRel(basepath, targpath string) string
- func NewPathError(op, name, text string) *os.PathError
- func PostfixWalk(root string, walkFn filepath.WalkFunc) error
- func ReadFileMagic(filename string) ([]byte, error)
- func RemoveEmptyDirectories(root string) error
- func SafeReplaceAllStringFunc(re *regexp.Regexp, src string, repl func(m string) (string, error)) (out string, err error)
- func SearchStrings(array []string, s string) bool
- func Slugify(s string) string
- func StringArrayToMap(a []string) map[string]bool
- func StringSet(array []string) map[string]bool
- func TrimExt(name string) string
- func URLJoin(paths ...string) string
- func URLPathClean(url string) string
- func UnmarshalYAMLInterface(b []byte, i *interface{}) error
- func VisitCreatedFile(filename string, w func(io.Writer) error) (err error)
- func WrapPathError(err error, path string) error
- type PathError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyToHTMLText ¶
ApplyToHTMLText applies a filter only to the text within an HTML document.
func CopyFileContents ¶
CopyFileContents copies the file contents from src to dst. It's not atomic and doesn't copy permissions or metadata.
func FilenameDate ¶
FilenameDate returns the date for a filename that uses Jekyll post convention. It also returns a bool indicating whether a date was found.
func FollowDots ¶
FollowDots applied to a property list ["a", "b", "c"] is equivalent to the Liquid data expression "data.a.b.c", except without special treatment of "first", "last", and "size".
func IsNotEmpty ¶
IsNotEmpty returns a boolean indicating whether the error is known to report that a directory is not empty.
func LeftPad ¶
LeftPad left-pads s with spaces to n wide. It's an alternative to http://left-pad.io.
func MatchList ¶
MatchList implement Jekyll include: and exclude: configurations. It reports whether any glob pattern matches the path. It panics with ErrBadPattern if any pattern is malformed. To match Jekyll, a string "dir/" matches that begins with this prefix.
func MergeStringMaps ¶
MergeStringMaps creates a new variable map that merges its arguments, from first to last.
func NewPathError ¶
NewPathError returns an os.PathError that formats as the given text.
func PostfixWalk ¶
PostfixWalk is like filepath.Walk, but visits each directory after visiting its children instead of before. It does not implement SkipDir.
func ReadFileMagic ¶
ReadFileMagic returns the first four bytes of the file, with final '\r' replaced by '\n'.
func RemoveEmptyDirectories ¶
RemoveEmptyDirectories recursively removes empty directories.
func SafeReplaceAllStringFunc ¶
func SafeReplaceAllStringFunc(re *regexp.Regexp, src string, repl func(m string) (string, error)) (out string, err error)
SafeReplaceAllStringFunc is like regexp.ReplaceAllStringFunc but passes an an error back from the replacement function.
func SearchStrings ¶
SearchStrings returns a bool indicating whether array contains the string. Unlike sort.SearchStrings, it does not require a sorted array. This is useful when the array length is low; else consider sorting it and using sort.SearchStrings, or creating a map[string]bool.
func StringArrayToMap ¶
StringArrayToMap creates a map for use as a set.
func StringSet ¶
StringSet creates a characteristic function map that tests for presence in an array.
func URLPathClean ¶
URLPathClean removes internal // etc. Unlike path.Clean, it leaves the final "/" intact.
func UnmarshalYAMLInterface ¶
UnmarshalYAMLInterface is a wrapper for yaml.Unmarshall that knows how to unmarshal maps and lists.
func VisitCreatedFile ¶
VisitCreatedFile calls os.Create to create a file, and applies w to it.
func WrapPathError ¶
WrapPathError returns an error that will print with a path.\ It wraps its argument if it is not nil and does not already provide a path.