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
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3
2 changed files with 17 additions and 28 deletions

View File

@ -1,22 +0,0 @@
<html>
{{> meta.html }}
<body>
{{> header.html }}
<div id="content">
{{#if Data.bild }}
<img src="{{ Data.bild }}" id="dataImg">
{{/if}}
{{{ BodyParts.[0] }}}
{{#if BodyParts.[1] }}
<div class="info">{{{ BodyParts.[1] }}}</div>
{{/if}}
</div>
{{> footer.html }}
</body>
</html>

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)