pagr

A 'static site generator', built using dati.
Log | Files | Refs | Atom

commit 1e588952cd6ccef84ae19830e81401bfe93894e5
parent 519b1d7ef4d2f2f5ccf2e00c56006e666382a9da
Author: gearsix <gearsix@tuta.io>
Date:   Mon, 14 Mar 2022 23:29:54 +0000

renamed config .Pages -> .Contents

Diffstat:
Mconfig.go | 8++++----
Mconfig_test.go | 6+++---
Mpagr.go | 6+++---
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/config.go b/config.go @@ -9,7 +9,7 @@ import ( // Config is the data structure containing all key/values to be loaded // in pagr configuration files type Config struct { - Pages string + Contents string Templates string Assets []string Output string @@ -17,14 +17,14 @@ type Config struct { // relPaths sets all filepath values in `cfg` relative to `dir` func (cfg *Config) relPaths(dir string) { - var paths = []string{cfg.Pages, cfg.Templates, cfg.Output} + var paths = []string{cfg.Contents, cfg.Templates, cfg.Output} paths = append(paths, cfg.Assets...) for i, path := range paths { if !filepath.IsAbs(path) { paths[i] = filepath.Join(dir, path) } } - cfg.Pages = paths[0] + cfg.Contents = paths[0] cfg.Templates = paths[1] cfg.Output = paths[2] cfg.Assets = paths[3:] @@ -34,7 +34,7 @@ func (cfg *Config) relPaths(dir string) { // NewConfig returns a Config with default values func NewConfig() Config { return Config{ - Pages: "./content", + Contents: "./content", Templates: "./templates", Assets: []string{"./assets"}, Output: "./out", diff --git a/config_test.go b/config_test.go @@ -19,7 +19,7 @@ func TestNewConfigFromFile(test *testing.T) { test.Skipf("failed to create config file: '%s'", cfgp) } else { f.WriteString(` - Pages = "./p" + Contents = "./p" Templates = "./t" Assets = ["./a"] Output = "./o"`) @@ -27,8 +27,8 @@ func TestNewConfigFromFile(test *testing.T) { } if cfg, err := NewConfigFromFile(cfgp); err == nil { - if cfg.Pages != filepath.Join(tdir, "p") { - test.Fatalf("invalid Pages path: '%s'", cfg.Pages) + if cfg.Contents != filepath.Join(tdir, "p") { + test.Fatalf("invalid Contents path: '%s'", cfg.Contents) } if cfg.Templates != filepath.Join(tdir, "t") { test.Fatalf("invalid Templates path: '%s'", cfg.Templates) diff --git a/pagr.go b/pagr.go @@ -62,7 +62,7 @@ func main() { vlog("loaded config: %s\n", config) var pages []Page - pages, err = LoadContentsDir(config.Pages) + pages, err = LoadContentsDir(config.Contents) check(err) ilog.Printf("loaded %d content pages", len(pages)) @@ -80,7 +80,7 @@ func main() { ilog.Printf("skipping %s: %s\n", page.Path, err) return } - check(page.CopyAssets(config.Pages, config.Output)) + check(page.CopyAssets(config.Contents, config.Output)) vlog("-> %s", page.Path) htmlc++ assetc += len(page.Assets) @@ -113,7 +113,7 @@ func buildPage(cfg Config, p Page, t []suti.Template) error { _, err := p.Build(cfg.Output, *tmpl) check(err) - check(p.CopyAssets(cfg.Pages, cfg.Output)) + check(p.CopyAssets(cfg.Contents, cfg.Output)) return err }