Skip to content

Commit

Permalink
docs: only compile root dir files
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Feb 10, 2024
1 parent aa30b69 commit e6fce80
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tools/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"html/template"
"io"
"io/fs"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -198,10 +197,15 @@ func Build(w io.Writer, dir string) error {
}
var positions []int
seen := make(map[string]struct{})
err := filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error {
if info.IsDir() {
return nil
entries, err := os.ReadDir(dir)
if err != nil {
return err
}
for _, entry := range entries {
if entry.IsDir() {
continue
}
path := filepath.Join(dir, entry.Name())
if filepath.Ext(path) != ".md" {
return nil
}
Expand All @@ -228,10 +232,6 @@ func Build(w io.Writer, dir string) error {
}
m.Menus = append(m.Menus, x)
m.Pages = append(m.Pages, template.HTML(b.String()))
return nil
})
if err != nil {
return err
}
x := &ms{indices: positions, m: &m}
sort.Sort(x)
Expand Down

0 comments on commit e6fce80

Please sign in to comment.