Skip to content

Commit

Permalink
fix: remove "." parent pages
Browse files Browse the repository at this point in the history
  • Loading branch information
justmiles committed Nov 29, 2019
1 parent 3b84b2e commit b0dbc4c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (m *Markdown2Confluence) Run() []error {

md := MarkdownFile{
Path: path,
Parents: strings.Split(filepath.Dir(strings.TrimPrefix(filepath.ToSlash(path), filepath.ToSlash(f))), "/"),
Parents: deleteFromSlice(strings.Split(filepath.Dir(strings.TrimPrefix(filepath.ToSlash(path), filepath.ToSlash(f))), "/"), "."),
Title: strings.TrimSuffix(filepath.Base(path), ".md"),
}

Expand Down Expand Up @@ -258,3 +258,13 @@ func deleteEmpty(s []string) []string {
}
return r
}

func deleteFromSlice(s []string, del string) []string {
for i, v := range s {
if v == del {
s = append(s[:i], s[i+1:]...)
break
}
}
return s
}

0 comments on commit b0dbc4c

Please sign in to comment.