From 6e4a680237539fe1d3b433b5da664766c8562851 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Fri, 15 Feb 2019 14:08:37 +0100 Subject: [PATCH] refactored code --- example/templates/mitBild.html | 22 ---------------------- main.go | 23 +++++++++++++++++------ 2 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 example/templates/mitBild.html diff --git a/example/templates/mitBild.html b/example/templates/mitBild.html deleted file mode 100644 index c3285be..0000000 --- a/example/templates/mitBild.html +++ /dev/null @@ -1,22 +0,0 @@ - - {{> meta.html }} - - {{> header.html }} - -
- - {{#if Data.bild }} - - {{/if}} - - {{{ BodyParts.[0] }}} - - {{#if BodyParts.[1] }} -
{{{ BodyParts.[1] }}}
- {{/if}} - -
- - {{> footer.html }} - - \ No newline at end of file diff --git a/main.go b/main.go index 932e974..ca20690 100644 --- a/main.go +++ b/main.go @@ -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)