32 lines
462 B
Go
32 lines
462 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"strings"
|
||
|
|
||
|
"git.akyoto.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
|
||
|
}
|