slug for output directories
All checks were successful
the build was successful

This commit is contained in:
Sebastian Frank
2019-02-14 14:42:46 +01:00
parent 1d3facc319
commit 1fecb5faae
6 changed files with 16 additions and 7 deletions

15
main.go
View File

@@ -12,6 +12,7 @@ import (
"github.com/davecgh/go-spew/spew"
"github.com/flosch/pongo2"
"github.com/gosimple/slug"
"github.com/op/go-logging"
cpy "github.com/otiai10/copy"
"gopkg.in/russross/blackfriday.v2"
@@ -155,19 +156,19 @@ func readContentDir(inBase string, outBase string, dir string, conf *PathConfig,
stripedDir = regex.ReplaceAllString(stripedDir, "$1")
}
}
regex := regexp.MustCompile("[^a-zA-Z]")
stripedDir = regex.ReplaceAllString(stripedDir, "_")
outPath := outBase + "/" + stripedDir
outPath = path.Clean(outPath)
log.Infof("calculated output directory: %s", outPath)
tree.OutputPath = outPath
if tree.Config.This.Navname == nil {
navname := strings.Replace(stripedDir, "_", " ", -1)
tree.Config.This.Navname = &navname
}
stripedDir = slug.Make(stripedDir)
outPath := outBase + "/" + stripedDir
outPath = path.Clean(outPath)
log.Infof("calculated output directory: %s", outPath)
tree.OutputPath = outPath
// first only files
for _, f := range files {
p := inPath + "/" + f.Name()