do not copy config.yml
This commit is contained in:
parent
1fecb5faae
commit
7dbaa95a90
28
main.go
28
main.go
@ -101,6 +101,16 @@ type PathConfigTree struct {
|
||||
|
||||
var contentConfig = new(PathConfigTree)
|
||||
|
||||
func backToRoot(curNavPath string) string {
|
||||
tmpPath := ""
|
||||
if curNavPath != "" {
|
||||
for i := strings.Count(curNavPath, "/") + 1; i > 0; i-- {
|
||||
tmpPath += "../"
|
||||
}
|
||||
}
|
||||
return tmpPath
|
||||
}
|
||||
|
||||
func readContentDir(inBase string, outBase string, dir string, conf *PathConfig, tree *PathConfigTree) {
|
||||
inPath := inBase
|
||||
if dir != "" {
|
||||
@ -172,7 +182,7 @@ func readContentDir(inBase string, outBase string, dir string, conf *PathConfig,
|
||||
// first only files
|
||||
for _, f := range files {
|
||||
p := inPath + "/" + f.Name()
|
||||
if !f.IsDir() {
|
||||
if !f.IsDir() && f.Name() != "config.yml" {
|
||||
switch path.Ext(f.Name()) {
|
||||
case ".md":
|
||||
log.Debugf(".MD %s", p)
|
||||
@ -274,11 +284,8 @@ func buildNavigation(conf *PathConfigTree, curNavMap *map[string]*navElement, cu
|
||||
|
||||
if activeNav != "" && activeNav != "/" {
|
||||
// calculate relative path
|
||||
tmpPath := ""
|
||||
for i := len(strings.Split(activeNav, "/")); i > 0; i-- {
|
||||
tmpPath += "../"
|
||||
}
|
||||
navEl.GoTo = tmpPath + navEl.GoTo
|
||||
bToRoot := backToRoot(activeNav)
|
||||
navEl.GoTo = bToRoot + navEl.GoTo
|
||||
navEl.GoTo = path.Clean(navEl.GoTo)
|
||||
}
|
||||
|
||||
@ -436,18 +443,13 @@ func processContent(conf *PathConfigTree) {
|
||||
|
||||
if find := globalConfig.Assets.FixTemplate.Find; find != "" {
|
||||
log.Debugf("fixing assets paths in '%s' for '%s'", templateFile, inFile)
|
||||
tmpPath := ""
|
||||
if curNavPath != "" {
|
||||
for i := len(strings.Split(curNavPath, "/")); i > 0; i-- {
|
||||
tmpPath += "../"
|
||||
}
|
||||
}
|
||||
bToRoot := backToRoot(curNavPath)
|
||||
regex, err := regexp.Compile(find)
|
||||
if err != nil {
|
||||
log.Panicf("could not compile regexp '%s' for assets path: %s", find, err)
|
||||
}
|
||||
repl := globalConfig.Assets.FixTemplate.Replace
|
||||
repl = tmpPath + globalConfig.Assets.ToPath + "/" + repl
|
||||
repl = bToRoot + globalConfig.Assets.ToPath + "/" + repl
|
||||
repl = path.Clean(repl) + "/"
|
||||
log.Debugf("new assets paths: %s", repl)
|
||||
result = regex.ReplaceAllString(result, repl)
|
||||
|
Loading…
Reference in New Issue
Block a user