32 lines
461 B
Go
32 lines
461 B
Go
package app
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
"git.urbach.dev/go/markdown"
|
|
)
|
|
|
|
func loadProjects(directory string) []string {
|
|
entries, err := os.ReadDir(directory)
|
|
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
projects := []string{}
|
|
|
|
for _, entry := range entries {
|
|
fileName := entry.Name()
|
|
|
|
if !strings.HasSuffix(fileName, ".md") {
|
|
continue
|
|
}
|
|
|
|
content := load("projects/" + fileName)
|
|
projects = append(projects, markdown.Render(content))
|
|
}
|
|
|
|
return projects
|
|
}
|