Documentation ¶
Index ¶
- Constants
- Variables
- type Env
- func (e *Env) BaseFilter(path string, d fs.DirEntry) error
- func (e *Env) Domain() string
- func (e *Env) FileFilter(path string, d fs.DirEntry) error
- func (e *Env) Filter(dir string, f FilterType) <-chan WalkEvent
- func (e *Env) Get(key string) any
- func (e *Env) GetBool(key string) bool
- func (e *Env) GetInt(key string) int
- func (e *Env) GetString(key string) string
- func (e *Env) IsAllowedBase(path string) bool
- func (e *Env) IsAllowedRoute(path string) bool
- func (e *Env) IsIgnored(path string) bool
- func (e *Env) List() string
- func (e *Env) Out(link string) string
- func (e *Env) Output() string
- func (e *Env) Root() string
- func (e *Env) RouteFilter(path string, d fs.DirEntry) error
- func (e *Env) Routes() string
- func (e *Env) Scan() (*Manifest, error)
- func (e *Env) Single() string
- func (e *Env) Static() string
- func (e *Env) Templates() string
- func (e *Env) Verbose() bool
- type FilterType
- type Ignore
- type Manifest
- type Markdown
- type Options
- type Taxonomies
- type Taxonomy
- type WalkEvent
Constants ¶
const ( // Recognized configuration file names. BaseName string = "onyx" YamlLongName string = BaseName + ".yaml" YamlShortName string = BaseName + ".yml" JsonName string = BaseName + ".json" // Defaults for file reading/writing, etc DefFilePerm fs.FileMode = 0644 DefDirPerm fs.FileMode = 0755 DefDateFmt string = "2006-01-02" )
Variables ¶
var Names = []string{ YamlLongName, JsonName, YamlShortName, }
Names contains all recognized project configuration file names.
Functions ¶
This section is empty.
Types ¶
type Env ¶
Env is a struct that contains the parsed arguments that were passed to the program, an instance of Options derived from the project's configuration file, and has methods to check state.
func (*Env) BaseFilter ¶
BaseFilter is a Filter that will allow files that appear to be base templates.
func (*Env) FileFilter ¶
FileFilter is a Filter that will return any file.
func (*Env) Filter ¶
func (e *Env) Filter(dir string, f FilterType) <-chan WalkEvent
Filter will return a channel and send any files in the given directory that match the given filter through the channel. An error will be returned if the directory cannot be accessed.
func (*Env) IsAllowedBase ¶
IsAllowedBase will return true when the given path leads to file that matches the naming convention of a base template. [base.tmpl | base_*.tmpl]
func (*Env) IsAllowedRoute ¶
IsAllowedRoute will return true when the given path leads to a recognized file type.
func (*Env) Out ¶
Out will return a write path for the given link that is relative the project's output directory.
func (*Env) RouteFilter ¶
RouteFilter is a Filter that will allow files of a recognized file type.
func (*Env) Scan ¶
Scan will scan the project and return a Manifest that details the location and types of files in the project.
type FilterType ¶
Filter is a function that returns an error when the given path and/or fs.DirEntry do not meet the requirements of the filter.
type Manifest ¶
type Manifest struct { // Paths to files that will become routes. Routes []string // Paths to files that are static, and will not be transformed. Static []string // Path to any additional base templates. BaseAlt []string // Path to the base template. Base string }
Manifest is an overview of the files available in a project.
type Markdown ¶
type Markdown struct {
Unsafe bool `json:"unsafe"`
}
Controls markdown conversion behavior.
type Options ¶
type Options struct { // Domain is used to prefix all output paths. Domain string `json:"domain"` // Output controls the location that the resulting files are placed. Output string `json:"output"` // Verbose determines how much information is logged. Verbose bool `json:"verbose"` Taxonomies `json:"taxonomies"` Markdown `json:"markdown"` Ignore `json:"ignore"` }
Options describes all of the values that might be found in a project's configuration file.
type Taxonomies ¶
type Taxonomies struct { List string `json:"list"` Single string `json:"single"` Sets []Taxonomy `json:"sets"` }
Taxonomies provides a way to identify a piece of metadata as a taxonomy.