feat(template): add multiple page support to templates
build / Go-Build (push) Successful in 1m30s

This commit is contained in:
2026-05-27 22:02:11 +02:00
parent 2aab1bcdd2
commit ba2332ecb6
5 changed files with 76 additions and 36 deletions
+4 -3
View File
@@ -2,6 +2,7 @@ package svg
import (
"errors"
"fmt"
"io"
"log"
"net/http"
@@ -20,7 +21,7 @@ type SvgStorage interface {
AddFont(reader io.Reader, format string) error
GetFonts() ([]string, error)
GetFontsDir() string
CreatePublic(data io.Reader, filetype string) (string, error)
CreatePublic(data io.Reader, suffix string, filetype string) (string, error)
GetPublic(path string) (io.ReadCloser, error)
GetPublicDir() http.Dir
}
@@ -86,13 +87,13 @@ func (f FileSvgStorage) List() ([]os.DirEntry, error) {
return os.ReadDir(f.basepath)
}
func (f FileSvgStorage) CreatePublic(data io.Reader, filetype string) (string, error) {
func (f FileSvgStorage) CreatePublic(data io.Reader, suffix string, filetype string) (string, error) {
path := filepath.Join(f.basepath, f.publicSubPath)
if err := os.MkdirAll(path, 0755); err != nil {
return "", err
}
file, err := os.CreateTemp(path, "*."+filetype)
file, err := os.CreateTemp(path, fmt.Sprintf("*-%s."+filetype, suffix))
if err != nil {
return "", err
}