content config
This commit is contained in:
22
main.go
22
main.go
@@ -4,6 +4,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
@@ -124,12 +125,21 @@ func readContentDir(d string, conf *PathConfig, tree *PathConfigTree) {
|
|||||||
|
|
||||||
tree.Config = newConfig
|
tree.Config = newConfig
|
||||||
|
|
||||||
// create outDir
|
// calc outDir
|
||||||
oDir := *outDir + "/" + strings.TrimPrefix(d, *inDir+"/content")
|
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.Replace(oDir, "//", "/", -1)
|
||||||
oDir = strings.TrimSuffix(oDir, "/")
|
oDir = strings.TrimSuffix(oDir, "/")
|
||||||
|
|
||||||
log.Noticef("creating output directory: %s", oDir)
|
log.Noticef("calculated output directory: %s", oDir)
|
||||||
tree.OutputPath = oDir
|
tree.OutputPath = oDir
|
||||||
|
|
||||||
// first only files
|
// first only files
|
||||||
@@ -155,6 +165,10 @@ func readContentDir(d string, conf *PathConfig, tree *PathConfigTree) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func processContent(conf *PathConfigTree) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
spew.Config.DisablePointerAddresses = true
|
spew.Config.DisablePointerAddresses = true
|
||||||
spew.Config.DisableCapacities = true
|
spew.Config.DisableCapacities = true
|
||||||
@@ -250,6 +264,8 @@ func main() {
|
|||||||
|
|
||||||
// log.Debug(spew.Sdump(contentConfig))
|
// log.Debug(spew.Sdump(contentConfig))
|
||||||
|
|
||||||
|
processContent(contentConfig)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
input, err := ioutil.ReadFile("README.md")
|
input, err := ioutil.ReadFile("README.md")
|
||||||
|
|||||||
Reference in New Issue
Block a user