feat: title on pages

This commit is contained in:
2026-03-19 18:27:23 +01:00
parent 2b07701762
commit 16e5107185
18 changed files with 251 additions and 36 deletions
+62
View File
@@ -0,0 +1,62 @@
package testdata
import (
"bytes"
"embed"
"io"
"os"
"strings"
)
//go:embed *
var fs embed.FS
func FS() mockFS {
return mockFS{
FS: fs,
}
}
type mockFS struct {
embed.FS
}
type mockMimer struct{ os.FileInfo }
func (m *mockMimer) ContentType() string {
parts := strings.Split(m.Name(), ".")
suffix := parts[len(parts)-1]
switch suffix {
case "jpg":
return "image/jpeg"
default:
return ""
}
}
func (m mockFS) Read(path string) (b []byte, err error) {
file, err := m.Open(path)
if err != nil {
return
}
defer file.Close()
buff := bytes.NewBuffer(make([]byte, 0, 1024))
_, err = io.Copy(buff, file)
return buff.Bytes(), err
}
func (m mockFS) Stat(path string) (info os.FileInfo, err error) {
file, err := m.Open(path)
if err != nil {
return
}
info, err = file.Stat()
info = &mockMimer{info}
return
}