move template files
25 files changed, 64 insertions(+), 56 deletions(-)
changed files
- domain/content/builder/builder.go
- domain/content/builder/template/template.go
- domain/content/publisher/app.go
- domain/content/publisher/mux.go
- domain/content/publisher/templates/index.go
- domain/content/publisher/templates/layout.go
- domain/web/mux.go
- domain/web/website.go
- kodata/feed-styles.xsl
- kodata/robots.tmpl
- kodata/style.css
- shared/storage/sqlite/writer.go
- domain/calendar/templates/calendar.go
- domain/web/templates/error.go
- domain/indieweb/templates/feed-styles.xsl
- domain/web/templates/files.go
- domain/content/templates/gopkg.go
- domain/content/templates/homepage.go
- domain/web/templates/layout.go
- domain/content/templates/list.go
- domain/content/templates/page.go
- domain/content/templates/post.go
- domain/web/templates/robots.tmpl
- domain/web/templates/style.css
- domain/content/templates/tags.go
M domain/content/builder/builder.go → domain/content/builder/builder.go
@@ -11,12 +11,13 @@ "time" "alin.ovh/homestead/domain/content" "alin.ovh/homestead/domain/content/builder/template" + ctemplates "alin.ovh/homestead/domain/content/templates" "alin.ovh/homestead/domain/indieweb/sitemap" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/buffer" "alin.ovh/homestead/shared/config" "alin.ovh/homestead/shared/storage" "alin.ovh/homestead/shared/vcs" - "alin.ovh/homestead/templates" "alin.ovh/x/log" "github.com/Southclaws/fault"@@ -100,7 +101,7 @@ for _, post := range cc.Posts { log.Debug("rendering post", "post", post.Basename) sitemap.AddPath(post.URL, post.Date) buf.Reset() - if err := templates.PostPage(siteSettings, post).Render(buf); err != nil { + if err := ctemplates.PostPage(siteSettings, post).Render(buf); err != nil { return fault.Wrap(err, fmsg.With("could not render post")) }@@ -111,7 +112,7 @@ } log.Debug("rendering tags list") buf.Reset() - if err := templates.TagsPage(siteSettings, templates.TagsPageVars{ + if err := ctemplates.TagsPage(siteSettings, ctemplates.TagsPageVars{ Title: "Tags", Tags: mapset.Sorted(cc.Tags), }).Render(buf); err != nil {@@ -132,7 +133,7 @@ } log.Debug("rendering tags page", "tag", tag) url := path.Join("/tags", tag) + "/" buf.Reset() - if err := templates.TagPage(siteSettings, templates.TagPageVars{ + if err := ctemplates.TagPage(siteSettings, ctemplates.TagPageVars{ Tag: tag, Posts: matchingPosts, }).Render(buf); err != nil {@@ -173,7 +174,7 @@ } log.Debug("rendering list page") buf.Reset() - if err := templates.ListPage(siteSettings, templates.ListPageVars{ + if err := ctemplates.ListPage(siteSettings, ctemplates.ListPageVars{ Posts: cc.Posts, }).Render(buf); err != nil { return fault.Wrap(err)@@ -222,7 +223,7 @@ for _, post := range cc.Pages { buf.Reset() log.Debug("rendering page", "source", post.Input, "path", post.URL) if post.URL == "/" { - if err := templates.Homepage(siteSettings, templates.HomepageVars{ + if err := ctemplates.Homepage(siteSettings, ctemplates.HomepageVars{ Email: config.PublicEmail, Me: config.RelMe, Posts: cc.Posts,@@ -230,7 +231,7 @@ }, post).Render(buf); err != nil { return fault.Wrap(err) } } else { - if err := templates.Page(siteSettings, post).Render(buf); err != nil { + if err := ctemplates.Page(siteSettings, post).Render(buf); err != nil { return fault.Wrap(err) } }@@ -280,7 +281,7 @@ log.Debug("rendering go packages") for _, p := range config.Go.Packages { buf.Reset() - if err := templates.GoPackagePage(siteSettings, &config.Go, p).Render(buf); err != nil { + if err := ctemplates.GoPackagePage(siteSettings, &config.Go, p).Render(buf); err != nil { return fault.Wrap(err) } if err := stor.Write(fmt.Sprintf("/go/%s.html", p), siteSettings.Title, buf); err != nil {@@ -289,7 +290,7 @@ } } buf.Reset() - if err := templates.GoPackageListPage(siteSettings, &config.Go).Render(buf); err != nil { + if err := ctemplates.GoPackageListPage(siteSettings, &config.Go).Render(buf); err != nil { return fault.Wrap(err) } if err := stor.Write("/go/", siteSettings.Title, buf); err != nil {
M domain/content/builder/template/template.go → domain/content/builder/template/template.go
@@ -8,8 +8,8 @@ "text/template" "alin.ovh/homestead/domain/content" "alin.ovh/homestead/domain/indieweb/atom" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/config" - "alin.ovh/homestead/templates" "github.com/PuerkitoBio/goquery" "github.com/Southclaws/fault"
M domain/content/publisher/app.go → domain/content/publisher/app.go
@@ -9,8 +9,8 @@ "go.hacdias.com/indielib/indieauth" ihttp "alin.ovh/homestead/domain/web/middleware" "alin.ovh/homestead/domain/web/server" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/config" - "alin.ovh/homestead/templates" "alin.ovh/x/log" )
M domain/content/publisher/mux.go → domain/content/publisher/mux.go
@@ -5,7 +5,7 @@ "net/http" pubtpl "alin.ovh/homestead/domain/content/publisher/templates" ihttp "alin.ovh/homestead/domain/web/middleware" - "alin.ovh/homestead/templates" + "alin.ovh/homestead/domain/web/templates" ) func (app *App) Index(w http.ResponseWriter, _ *http.Request) *ihttp.Error {
M domain/content/publisher/templates/index.go → domain/content/publisher/templates/index.go
@@ -2,7 +2,7 @@ package templates import ( g "alin.ovh/gomponents" - base "alin.ovh/homestead/templates" + base "alin.ovh/homestead/domain/web/templates" ) func IndexPage(site base.SiteSettings, page base.PageSettings) g.Node {
M domain/content/publisher/templates/layout.go → domain/content/publisher/templates/layout.go
@@ -1,7 +1,7 @@ package templates import ( - base "alin.ovh/homestead/templates" + base "alin.ovh/homestead/domain/web/templates" g "alin.ovh/gomponents" c "alin.ovh/gomponents/components"
M domain/web/mux.go → domain/web/mux.go
@@ -8,9 +8,10 @@ "regexp" "slices" "strings" + calendar "alin.ovh/homestead/domain/calendar/templates" ihttp "alin.ovh/homestead/domain/web/middleware" "alin.ovh/homestead/domain/web/server" - "alin.ovh/homestead/templates" + "alin.ovh/homestead/domain/web/templates" "github.com/kevinpollet/nego" )@@ -102,7 +103,7 @@ } func (website *Website) Calendar(w http.ResponseWriter, r *http.Request) *ihttp.Error { website.counter.Count(r, "Calendar") - err := templates.CalendarPage(*website.siteSettings, templates.PageSettings{ + err := calendar.CalendarPage(*website.siteSettings, templates.PageSettings{ Title: "Calendar", TitleAttrs: templates.Attrs{}, BodyAttrs: templates.Attrs{},
M domain/web/website.go → domain/web/website.go
@@ -16,12 +16,12 @@ "alin.ovh/homestead/domain/calendar" "alin.ovh/homestead/domain/content/fetcher" ihttp "alin.ovh/homestead/domain/web/middleware" "alin.ovh/homestead/domain/web/server" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/config" "alin.ovh/homestead/shared/events" "alin.ovh/homestead/shared/file" "alin.ovh/homestead/shared/storage" "alin.ovh/homestead/shared/storage/sqlite" - "alin.ovh/homestead/templates" "alin.ovh/x/log" "github.com/Southclaws/fault" "github.com/Southclaws/fault/fmsg"
M kodata/feed-styles.xsl → kodata/feed-styles.xsl
@@ -1,1 +1,1 @@ -../templates/feed-styles.xsl+../domain/indieweb/templates/feed-styles.xsl
M kodata/robots.tmpl → kodata/robots.tmpl
@@ -1,1 +1,1 @@ -../templates/robots.tmpl+../domain/web/templates/robots.tmpl
M kodata/style.css → kodata/style.css
@@ -1,1 +1,1 @@ -../templates/style.css+../domain/web/templates/style.css
M templates/calendar.go → domain/calendar/templates/calendar.go
@@ -10,17 +10,18 @@ . "alin.ovh/gomponents/html" "vimagination.zapto.org/ics" "alin.ovh/homestead/domain/calendar" + "alin.ovh/homestead/domain/web/templates" ) func CalendarPage( - site SiteSettings, - page PageSettings, + site templates.SiteSettings, + page templates.PageSettings, cal calendar.Calendar, ) g.Node { - return Layout(site, page, Calendar(site, cal)) + return templates.Layout(site, page, Calendar(site, cal)) } -func Calendar(site SiteSettings, cal calendar.Calendar) g.Node { +func Calendar(site templates.SiteSettings, cal calendar.Calendar) g.Node { past := true dates, err := cal.Availability(2) if err != nil {
M templates/gopkg.go → domain/content/templates/gopkg.go
@@ -6,6 +6,7 @@ "net/url" g "alin.ovh/gomponents" . "alin.ovh/gomponents/html" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/config" )@@ -15,10 +16,10 @@ Domain config.URL Forge config.URL } -func GoPackageListPage(site SiteSettings, cfg *config.GoPackagesConfig) g.Node { - return Layout(site, PageSettings{ +func GoPackageListPage(site templates.SiteSettings, cfg *config.GoPackagesConfig) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: site.Title, - TitleAttrs: Attrs{"class": "p-author h-card"}, + TitleAttrs: templates.Attrs{"class": "p-author h-card"}, }, Table( THead(@@ -41,10 +42,10 @@ ), ) } -func GoPackagePage(site SiteSettings, cfg *config.GoPackagesConfig, pkg string) g.Node { - return Layout(site, PageSettings{ +func GoPackagePage(site templates.SiteSettings, cfg *config.GoPackagesConfig, pkg string) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: site.Title, - TitleAttrs: Attrs{"class": "p-author h-card"}, + TitleAttrs: templates.Attrs{"class": "p-author h-card"}, HeadExtra: g.Group{ Meta(Name("go-import"), Content(importString(cfg, pkg))), Meta(Name("go-source"), Content(sourceString(cfg, pkg))),
M templates/homepage.go → domain/content/templates/homepage.go
@@ -2,6 +2,7 @@ package templates import ( "alin.ovh/homestead/domain/content" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/config" g "alin.ovh/gomponents"@@ -14,11 +15,11 @@ Me []config.MenuItem Posts []*content.Post } -func Homepage(site SiteSettings, vars HomepageVars, content g.Node) g.Node { - return Layout(site, PageSettings{ +func Homepage(site templates.SiteSettings, vars HomepageVars, content g.Node) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: site.Title, - TitleAttrs: Attrs{"class": "p-name u-url"}, - BodyAttrs: Attrs{"class": "h-card"}, + TitleAttrs: templates.Attrs{"class": "p-name u-url"}, + BodyAttrs: templates.Attrs{"class": "h-card"}, }, Div( ID("content"),
M templates/list.go → domain/content/templates/list.go
@@ -2,6 +2,7 @@ package templates import ( "alin.ovh/homestead/domain/content" + "alin.ovh/homestead/domain/web/templates" g "alin.ovh/gomponents" . "alin.ovh/gomponents/html"@@ -12,10 +13,10 @@ Tag string Posts []*content.Post } -func TagPage(site SiteSettings, vars TagPageVars) g.Node { - return Layout(site, PageSettings{ +func TagPage(site templates.SiteSettings, vars TagPageVars) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: vars.Tag, - TitleAttrs: Attrs{"class": "p-author h-card"}, + TitleAttrs: templates.Attrs{"class": "p-author h-card"}, }, Div( ID("content"), Div(Class("filter"),@@ -32,10 +33,10 @@ type ListPageVars struct { Posts []*content.Post } -func ListPage(site SiteSettings, vars ListPageVars) g.Node { - return Layout(site, PageSettings{ +func ListPage(site templates.SiteSettings, vars ListPageVars) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: site.Title, - TitleAttrs: Attrs{"class": "p-author h-card"}, + TitleAttrs: templates.Attrs{"class": "p-author h-card"}, }, Div( ID("content"),
M templates/page.go → domain/content/templates/page.go
@@ -2,15 +2,16 @@ package templates import ( "alin.ovh/homestead/domain/content" + "alin.ovh/homestead/domain/web/templates" g "alin.ovh/gomponents" . "alin.ovh/gomponents/html" ) -func Page(site SiteSettings, page *content.Post) g.Node { - return Layout(site, PageSettings{ +func Page(site templates.SiteSettings, page *content.Post) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: page.Title, - TitleAttrs: Attrs{"class": "h-card", "rel": "author"}, + TitleAttrs: templates.Attrs{"class": "h-card", "rel": "author"}, }, Article( Header( H1(Class("p-name"), g.Text(page.Title)),
M templates/post.go → domain/content/templates/post.go
@@ -4,17 +4,18 @@ import ( "time" "alin.ovh/homestead/domain/content" + "alin.ovh/homestead/domain/web/templates" "alin.ovh/homestead/shared/vcs" g "alin.ovh/gomponents" . "alin.ovh/gomponents/html" ) -func PostPage(site SiteSettings, post *content.Post) g.Node { - return Layout(site, PageSettings{ +func PostPage(site templates.SiteSettings, post *content.Post) g.Node { + return templates.Layout(site, templates.PageSettings{ Title: post.Title, - TitleAttrs: Attrs{"class": "p-author h-card", "rel": "author"}, - BodyAttrs: Attrs{"class": "h-entry"}, + TitleAttrs: templates.Attrs{"class": "p-author h-card", "rel": "author"}, + BodyAttrs: templates.Attrs{"class": "h-entry"}, }, Article( Header( H1(Class("p-name"), g.Text(post.Title)),