From 71931dfa4e632eb780fc483641cf50230843a824 Mon Sep 17 00:00:00 2001 From: adnano Date: Sun, 11 Apr 2021 18:42:55 -0400 Subject: [PATCH] config: Tweak variable names --- config.go | 24 ++++++++++++------------ main.go | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config.go b/config.go index e6a168b..2709896 100644 --- a/config.go +++ b/config.go @@ -23,16 +23,16 @@ type Config struct { // Task represents a site build task. type Task struct { - Input string `toml:"input"` // input file extension - Output string `toml:"output"` // output file extension - Template string `toml:"template"` // template file extension - PostProcess string `toml:"postprocess"` // postprocess directive - Static string `toml:"static"` // static file directory - Destination string `toml:"destination"` // destination directory + InputExt string `toml:"input_ext"` // input file extension + OutputExt string `toml:"output_ext"` // output file extension + TemplateExt string `toml:"template_ext"` // template file extension + PostProcess string `toml:"postprocess"` // postprocess command + StaticDir string `toml:"static_dir"` // static file directory + OutputDir string `toml:"output_dir"` // output directory } func (t Task) Format(p *Page) (string, []byte) { - path := path.Join(p.Path, "index"+t.Output) + path := path.Join(p.Path, "index"+t.OutputExt) // Run a custom command. if t.PostProcess != "" { @@ -56,11 +56,11 @@ func DefaultConfig() *Config { c.Feeds = make(map[string]string) c.Tasks = make(map[string]*Task) c.Tasks["gemini"] = &Task{ - Input: ".gmi", - Output: ".gmi", - Template: ".gmi", - Static: "static", - Destination: "public", + InputExt: ".gmi", + OutputExt: ".gmi", + TemplateExt: ".gmi", + StaticDir: "static", + OutputDir: "public", } return c } diff --git a/main.go b/main.go index 24fdda0..2b2be39 100644 --- a/main.go +++ b/main.go @@ -61,9 +61,9 @@ func runAll(cfg *Config) error { func runTask(cfg *Config, task *Task) error { // Load content dir := NewDir("") - dir.inputExt = task.Input - dir.outputExt = task.Output - dir.templateExt = task.Template + dir.inputExt = task.InputExt + dir.outputExt = task.OutputExt + dir.templateExt = task.TemplateExt if err := dir.read("content", ""); err != nil { return err } @@ -73,12 +73,12 @@ func runTask(cfg *Config, task *Task) error { return err } // Write content - if err := dir.write(task.Destination, task); err != nil { + if err := dir.write(task.OutputDir, task); err != nil { return err } // Copy static files - if task.Static != "" { - err := copyAll(task.Static, task.Destination) + if task.StaticDir != "" { + err := copyAll(task.StaticDir, task.OutputDir) if err != nil { return err }