Documentation ¶
Index ¶
- type FileSystemRegistry
- func (fsr *FileSystemRegistry) LinkHandler(fh sprout.Handler) error
- func (fsr *FileSystemRegistry) OsBase(str string) string
- func (fsr *FileSystemRegistry) OsClean(str string) string
- func (fsr *FileSystemRegistry) OsDir(str string) string
- func (fsr *FileSystemRegistry) OsExt(str string) string
- func (fsr *FileSystemRegistry) OsIsAbs(str string) bool
- func (fsr *FileSystemRegistry) PathBase(str string) string
- func (fsr *FileSystemRegistry) PathClean(str string) string
- func (fsr *FileSystemRegistry) PathDir(str string) string
- func (fsr *FileSystemRegistry) PathExt(str string) string
- func (fsr *FileSystemRegistry) PathIsAbs(str string) bool
- func (fsr *FileSystemRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
- func (fsr *FileSystemRegistry) Uid() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystemRegistry ¶
type FileSystemRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *FileSystemRegistry
NewRegistry creates a new instance of filesystem registry.
func (*FileSystemRegistry) LinkHandler ¶
func (fsr *FileSystemRegistry) LinkHandler(fh sprout.Handler) error
LinkHandler links the handler to the registry at runtime.
func (*FileSystemRegistry) OsBase ¶
func (fsr *FileSystemRegistry) OsBase(str string) string
OsBase returns the last element of the path, using the OS-specific path separator.
Parameters:
str string - the path string.
Returns:
string - the base element of the path.
Example:
{{ "C:\\path\\to\\file.txt" | osBase }} // Output: "file.txt"
func (*FileSystemRegistry) OsClean ¶
func (fsr *FileSystemRegistry) OsClean(str string) string
OsClean cleans up the path, using the OS-specific path separator and simplifying redundancies.
Parameters:
str string - the path string.
Returns:
string - the cleaned path.
Example:
{{ "C:\\path\\\\to\\file.txt" | osClean }} // Output: "C:\\path\\to\\file.txt"
func (*FileSystemRegistry) OsDir ¶
func (fsr *FileSystemRegistry) OsDir(str string) string
OsDir returns all but the last element of the path, using the OS-specific path separator.
Parameters:
str string - the path string.
Returns:
string - the directory part of the path.
Example:
{{ "C:\\path\\to\\file.txt" | osDir }} // Output: "C:\\path\\to"
func (*FileSystemRegistry) OsExt ¶
func (fsr *FileSystemRegistry) OsExt(str string) string
OsExt returns the file extension of the path, using the OS-specific path separator.
Parameters:
str string - the path string.
Returns:
string - the extension of the file in the path.
Example:
{{ "C:\\path\\to\\file.txt" | osExt }} // Output: ".txt"
func (*FileSystemRegistry) OsIsAbs ¶
func (fsr *FileSystemRegistry) OsIsAbs(str string) bool
OsIsAbs checks if the path is absolute, using the OS-specific path separator.
Parameters:
str string - the path string.
Returns:
bool - true if the path is absolute, otherwise false.
Example:
{{ "C:\\path\\to\\file.txt" | osIsAbs }} // Output: true
func (*FileSystemRegistry) PathBase ¶
func (fsr *FileSystemRegistry) PathBase(str string) string
PathBase returns the last element of the path.
Parameters:
str string - the path string.
Returns:
string - the base element of the path.
Example:
{{ "/path/to/file.txt" | pathBase }} // Output: "file.txt"
func (*FileSystemRegistry) PathClean ¶
func (fsr *FileSystemRegistry) PathClean(str string) string
PathClean cleans up the path, simplifying any redundancies like double slashes.
Parameters:
str string - the path string.
Returns:
string - the cleaned path.
Example:
{{ "/path//to/file.txt" | pathClean }} // Output: "/path/to/file.txt"
func (*FileSystemRegistry) PathDir ¶
func (fsr *FileSystemRegistry) PathDir(str string) string
PathDir returns all but the last element of the path, effectively the path's directory.
Parameters:
str string - the path string.
Returns:
string - the directory part of the path.
Example:
{{ "/path/to/file.txt" | pathDir }} // Output: "/path/to"
func (*FileSystemRegistry) PathExt ¶
func (fsr *FileSystemRegistry) PathExt(str string) string
PathExt returns the file extension of the path.
Parameters:
str string - the path string.
Returns:
string - the extension of the file in the path.
Example:
{{ "/path/to/file.txt" | pathExt }} // Output: ".txt"
func (*FileSystemRegistry) PathIsAbs ¶
func (fsr *FileSystemRegistry) PathIsAbs(str string) bool
PathIsAbs checks if the path is absolute.
Parameters:
str string - the path string.
Returns:
bool - true if the path is absolute, otherwise false.
Example:
{{ "/path/to/file.txt" | pathIsAbs }} // Output: true
func (*FileSystemRegistry) RegisterFunctions ¶
func (fsr *FileSystemRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
RegisterFunctions registers all functions of the registry.
func (*FileSystemRegistry) Uid ¶
func (fsr *FileSystemRegistry) Uid() string
Uid returns the unique identifier of the registry.