1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-19 15:12:49 +00:00

Rename ExtraData to more appropriate BodyAttributes

This commit is contained in:
kez 2022-08-14 14:34:48 -07:00 committed by Timur Ismagilov
parent f3437d93c8
commit e0f2868d34
2 changed files with 17 additions and 17 deletions

View File

@ -15,7 +15,7 @@
<script src="/static/shortcuts.js"></script>
{{range .HeadElements}}{{.}}{{end}}
</head>
<body data-rrh-addr="{{if .Addr}}{{.Addr}}{{else}}{{.Meta.Addr}}{{end}}"{{range .ExtraData}} data-rrh-{{.}}=""{{end}}>
<body data-rrh-addr="{{if .Addr}}{{.Addr}}{{else}}{{.Meta.Addr}}{{end}}"{{range .BodyAttributes}} data-rrh-{{.}}=""{{end}}>
<header>
<nav class="main-width top-bar">
<ul class="top-bar__wrapper">

View File

@ -91,14 +91,14 @@ func localizedBaseWithWeirdBody(meta Meta) *template.Template {
}
type BaseData struct {
Meta Meta
HeadElements []string
HeaderLinks []HeaderLink
CommonScripts []string
Addr string
Title string // TODO: remove
Body string // TODO: remove
ExtraData []string
Meta Meta
HeadElements []string
HeaderLinks []HeaderLink
CommonScripts []string
Addr string
Title string // TODO: remove
Body string // TODO: remove
BodyAttributes []string
}
func (bd *BaseData) withBaseValues(meta Meta, headerLinks []HeaderLink, commonScripts []string) {
@ -114,13 +114,13 @@ func Base(meta Meta, title, body string, extraData []string, headElements ...str
meta.W = &w
t := localizedBaseWithWeirdBody(meta)
err := t.ExecuteTemplate(&w, "page", BaseData{
Meta: meta,
Title: title,
HeadElements: headElements,
HeaderLinks: HeaderLinks,
CommonScripts: cfg.CommonScripts,
Body: body,
ExtraData: extraData,
Meta: meta,
Title: title,
HeadElements: headElements,
HeaderLinks: HeaderLinks,
CommonScripts: cfg.CommonScripts,
Body: body,
BodyAttributes: extraData,
})
if err != nil {
log.Println(err)