2025-01-21 14:00:40 +01:00
|
|
|
package app
|
2024-07-30 00:12:12 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
2025-02-25 17:01:59 +01:00
|
|
|
"git.urbach.dev/go/markdown"
|
2024-07-30 00:12:12 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|