refactored code
All checks were successful
the build was successful

This commit is contained in:
Sebastian Frank
2019-02-15 14:08:37 +01:00
parent 7dbaa95a90
commit 6e4a680237
2 changed files with 17 additions and 28 deletions

23
main.go
View File

@@ -317,6 +317,23 @@ func processContent(conf *PathConfigTree) {
log.Panicf("unknown error for output directory '%s': %s", conf.OutputPath, err)
}
curNavPath := strings.TrimPrefix(conf.OutputPath, *outDir)
curNavPath = strings.TrimPrefix(curNavPath, "/")
curNavPath = path.Clean(curNavPath)
if curNavPath == "." {
curNavPath = ""
}
goTo := conf.Config.This.GoTo
if goTo != nil && *goTo != "" {
goToFixed := *goTo
if strings.HasPrefix(goToFixed, "/") {
goToFixed = backToRoot(curNavPath) + goToFixed
}
log.Error(goToFixed)
}
for _, file := range conf.InputFiles {
inFile := conf.InputPath + "/" + file
log.Debugf("reading file: %s", inFile)
@@ -415,12 +432,6 @@ func processContent(conf *PathConfigTree) {
}
// build navigation
curNavPath := strings.TrimPrefix(conf.OutputPath, *outDir)
curNavPath = strings.TrimPrefix(curNavPath, "/")
curNavPath = path.Clean(curNavPath)
if curNavPath == "." {
curNavPath = ""
}
navMap := make(map[string]*navElement)
navSlice := make([]*navElement, 0)
navActive := make([]*navElement, 0)