IgnoreForNav

This commit is contained in:
Sebastian Frank 2019-02-13 13:26:49 +01:00
parent 01fa98b28c
commit 7f3b4ab8f9
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3

12
main.go
View File

@ -257,6 +257,18 @@ type navElement struct {
func buildNavigation(conf *PathConfigTree, curNavMap *map[string]*navElement, curNavSlice *[]*navElement, activeNav string) { func buildNavigation(conf *PathConfigTree, curNavMap *map[string]*navElement, curNavSlice *[]*navElement, activeNav string) {
for _, el := range conf.Sub { for _, el := range conf.Sub {
ignNav := el.Config.Path.IgnoreForNav
if ignNav != nil && *ignNav != "" {
regex, err := regexp.Compile(*ignNav)
if err != nil {
log.Panicf("could not compile IngoreForNav regexp '%s' in '%s': %s", *ignNav, el.InputPath, err)
}
if regex.MatchString(path.Base(el.InputPath)) {
log.Noticef("ignoring input directory '%s' in navigation", el.InputPath)
continue
}
}
elPath := strings.TrimPrefix(el.OutputPath, *outDir+"/") elPath := strings.TrimPrefix(el.OutputPath, *outDir+"/")
subMap := make(map[string]*navElement) subMap := make(map[string]*navElement)