content config
This commit is contained in:
22
main.go
22
main.go
@@ -4,6 +4,7 @@ import (
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
@@ -124,12 +125,21 @@ func readContentDir(d string, conf *PathConfig, tree *PathConfigTree) {
|
||||
|
||||
tree.Config = newConfig
|
||||
|
||||
// create outDir
|
||||
oDir := *outDir + "/" + strings.TrimPrefix(d, *inDir+"/content")
|
||||
// calc outDir
|
||||
stripedD := d
|
||||
regexStr := newConfig.Path.Strip
|
||||
if regexStr != nil && *regexStr != "" {
|
||||
if regex, err := regexp.Compile("^[0-9]*_"); err != nil {
|
||||
log.Panicf("error compiling path.strip regex '%s' from '%s': %s", *regexStr, p, err)
|
||||
} else {
|
||||
stripedD = regex.ReplaceAllString(stripedD, "")
|
||||
}
|
||||
}
|
||||
oDir := *outDir + "/" + strings.TrimPrefix(stripedD, *inDir+"/content")
|
||||
oDir = strings.Replace(oDir, "//", "/", -1)
|
||||
oDir = strings.TrimSuffix(oDir, "/")
|
||||
|
||||
log.Noticef("creating output directory: %s", oDir)
|
||||
log.Noticef("calculated output directory: %s", oDir)
|
||||
tree.OutputPath = oDir
|
||||
|
||||
// first only files
|
||||
@@ -155,6 +165,10 @@ func readContentDir(d string, conf *PathConfig, tree *PathConfigTree) {
|
||||
}
|
||||
}
|
||||
|
||||
func processContent(conf *PathConfigTree) {
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
spew.Config.DisablePointerAddresses = true
|
||||
spew.Config.DisableCapacities = true
|
||||
@@ -250,6 +264,8 @@ func main() {
|
||||
|
||||
// log.Debug(spew.Sdump(contentConfig))
|
||||
|
||||
processContent(contentConfig)
|
||||
|
||||
/*
|
||||
|
||||
input, err := ioutil.ReadFile("README.md")
|
||||
|
||||
Reference in New Issue
Block a user