mirror of
https://github.com/go-shiori/shiori.git
synced 2025-09-08 14:05:54 +08:00
* migrate bookmark content route to new http server * new archive page * remove unused go generate comment * database mock * utils cleanup * unused var * domains refactor and tests * fixed secret key type * redirect to login on ui errors * fixed archive folder with storage domain * webroot documentation * some bookmark route tests * fixed error in bookmark domain for non existant bookmarks * centralice errors * add coverage data to unittests * added tests, refactor storage to use afero * removed mock to avoid increasing complexity * using deps to copy files around * remove config usage (to deps) * remove handler-ui file
25 lines
599 B
Go
25 lines
599 B
Go
package templates
|
|
|
|
import (
|
|
"fmt"
|
|
"html/template"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
views "github.com/go-shiori/shiori/internal/view"
|
|
)
|
|
|
|
const (
|
|
leftTemplateDelim = "$$"
|
|
rightTemplateDelim = "$$"
|
|
)
|
|
|
|
// SetupTemplates sets up the templates for the webserver.
|
|
func SetupTemplates(engine *gin.Engine) error {
|
|
engine.Delims(leftTemplateDelim, rightTemplateDelim)
|
|
tmpl, err := template.New("html").Delims(leftTemplateDelim, rightTemplateDelim).ParseFS(views.Templates, "*.html")
|
|
if err != nil {
|
|
return fmt.Errorf("failed to parse templates: %w", err)
|
|
}
|
|
engine.SetHTMLTemplate(tmpl)
|
|
return nil
|
|
}
|