diff --git a/article/article.go b/templates.go rename from article/article.go rename to templates.go index c64176615e798ea219fac2d7139316204ba2ef8b..eac3264e98393a7f3d716c7531062157f9bbb7c7 100644 --- a/article/article.go +++ b/templates.go @@ -1,4 +1,4 @@ -package article +package main import ( "bytes" @@ -35,7 +35,7 @@ Summary string Date time.Time Category string Draft bool - Path string + path string } type Author struct { diff --git a/flake.lock b/flake.lock index e44a27858743e763f38bf246902f21a8561b6d93..f5bcb522d6f69dcc5e62033951b6297b31a4d3aa 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,81 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "templ", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "templ", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722589758, + "narHash": "sha256-sbbA8b6Q2vB/t/r1znHawoXLysCyD4L/6n6/RykiSnA=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "4e08ca09253ef996bd4c03afa383b23e35fe28a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1728679842, @@ -17,7 +93,68 @@ } }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "templ": "templ" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "templ": { + "inputs": { + "gitignore": "gitignore", + "gomod2nix": "gomod2nix", + "nixpkgs": [ + "nixpkgs" + ], + "xc": "xc" + }, + "locked": { + "lastModified": 1728028863, + "narHash": "sha256-NEkcOnjMN+fI9/Lejy6As3/Cd0rxqU4c4Dwt7OYiiLM=", + "owner": "a-h", + "repo": "templ", + "rev": "318249d145b66fe1d66e34abf2321c86e1dfbc52", + "type": "github" + }, + "original": { + "owner": "a-h", + "repo": "templ", + "type": "github" + } + }, + "xc": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "templ", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724404748, + "narHash": "sha256-p6rXzNiDm2uBvO1MLzC5pJp/0zRNzj/snBzZI0ce62s=", + "owner": "joerdav", + "repo": "xc", + "rev": "960ff9f109d47a19122cfb015721a76e3a0f23a2", + "type": "github" + }, + "original": { + "owner": "joerdav", + "repo": "xc", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 5f2080a8a7ab812405cba8a6fb7e616980ae62ef..a1035961990ef9c3456531756fbb44e2041919d0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,22 @@ { - inputs.nixpkgs.url = "github:nixos/nixpkgs"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + templ = { + url = "github:a-h/templ"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; outputs = { self, nixpkgs, - }: + templ, + }@inputs: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; + templ = inputs.templ.packages.${system}.templ; in { packages.${system}.default = pkgs.buildGoModule { @@ -16,6 +24,7 @@ pname = "blog.jolheiser.com"; version = "blog"; src = ./.; vendorHash = nixpkgs.lib.fileContents ./go.mod.sri; + nativeBuildInputs = [ templ ]; excludedPackages = "."; postBuild = '' export BLOG_REF=${self.rev or "main"} @@ -26,6 +35,7 @@ }; devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ go + templ vscode-langservers-extracted ]; }; diff --git a/go.mod b/go.mod index 6612b487ce9569eb6f6631fbcd942dd368822da8..e83daac31f4290202ee032f1f498df6067f1bfaf 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,13 @@ go 1.21.6 require ( github.com/BurntSushi/toml v1.3.2 + github.com/a-h/templ v0.2.778 github.com/alecthomas/chroma/v2 v2.12.0 github.com/gorilla/feeds v1.1.2 github.com/yuin/goldmark v1.7.0 github.com/yuin/goldmark-emoji v1.0.2 github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc github.com/yuin/goldmark-meta v1.1.0 - maragu.dev/gomponents v1.0.0 ) require ( diff --git a/go.mod.sri b/go.mod.sri index 2e45981dcfb9dfc156c9d140e67423b2a36d9cdb..7787f01765df1420a0e1db54ada9b7c5842e76af 100644 --- a/go.mod.sri +++ b/go.mod.sri @@ -1 +1 @@ -sha256-oWVGWTuqOTwGw9Kkx48PRzpmpgDkkAEJC6js0S1Aeok= \ No newline at end of file +sha256-AdXfH+hHYm0KXW9eXquZnWt49EimmMjpbUYOMEvamX8= \ No newline at end of file diff --git a/go.sum b/go.sum index 3689afea929185f9a2999bd96e0bb387efed908e..5623fc73ffd61df27ee192120e5fa9d9d3d8ec3e 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/a-h/templ v0.2.778 h1:VzhOuvWECrwOec4790lcLlZpP4Iptt5Q4K9aFxQmtaM= +github.com/a-h/templ v0.2.778/go.mod h1:lq48JXoUvuQrU0VThrK31yFwdRjTCnIE5bcPCM9IP1w= github.com/alecthomas/assert/v2 v2.2.1 h1:XivOgYcduV98QCahG8T5XTezV5bylXe+lBxLG2K2ink= github.com/alecthomas/assert/v2 v2.2.1/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs= @@ -14,6 +16,8 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/feeds v1.1.2 h1:pxzZ5PD3RJdhFH2FsJJ4x6PqMqbgFk1+Vez4XWBW8Iw= github.com/gorilla/feeds v1.1.2/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= @@ -43,5 +47,3 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -maragu.dev/gomponents v1.0.0 h1:eeLScjq4PqP1l+r5z/GC+xXZhLHXa6RWUWGW7gSfLh4= -maragu.dev/gomponents v1.0.0/go.mod h1:oEDahza2gZoXDoDHhw8jBNgH+3UR5ni7Ur648HORydM= diff --git a/html/html.go b/html/html.go deleted file mode 100644 index 647975c240e21fe427b758ecd8da3bd400f26541..0000000000000000000000000000000000000000 --- a/html/html.go +++ /dev/null @@ -1,91 +0,0 @@ -package html - -import ( - "fmt" - "os" - - "blog.jolheiser.com/article" - . "maragu.dev/gomponents" - . "maragu.dev/gomponents/components" - . "maragu.dev/gomponents/html" -) - -var ref = "main" - -func init() { - if r, ok := os.LookupEnv("BLOG_REF"); ok { - ref = r - } -} - -func base(title, description string, children ...Node) Node { - return HTML5(HTML5Props{ - Title: title, - Description: description, - Head: []Node{ - Meta(Property("og:title"), Content(title)), - Meta(Property("og:description"), Content(description)), - Link(Rel("alternate"), Type("application/atom+xml"), Href("feed.atom")), - Link(Rel("stylesheet"), Href("sakura.css")), - Link(Rel("stylesheet"), Href("chroma.css")), - Link(Rel("stylesheet"), Href("jolheiser.css")), - }, - Body: children, - }) -} - -func published(articles []article.Article) int { - var num int - for _, a := range articles { - if !a.Draft { - num++ - } - } - return num -} - -func IndexHTML(articles article.Articles) Node { - categories := make([]Node, 0, len(articles)) - for category, articles := range articles { - if published(articles) > 0 { - categories = append(categories, Group([]Node{ - H3(Text(category)), - Ul(Map(articles, func(article article.Article) Node { - if article.Draft { - return nil - } - return Li( - A(Href(article.Slug()), Text(article.Title)), - ) - })), - })) - } - } - return base("jolheiser's blog", "Hahaha yes.....YES!", []Node{ - Header( - H1(Text("jolheiser")), - P(Text("Just a guy living in the middle of nowhere who likes to hack on open-source.")), - ), - Main(Group(categories)), - }...) -} - -func ArticleHTML(article article.Article) Node { - return base(article.Title, article.Summary, []Node{ - Header( - H1(A(Href("/"), Small(Text("jolheiser")))), - Hr(), - H2(Text(article.Title)), - Div(Style("display: flex;"), - P(Style("flex: auto;"), Em(Text(article.Category))), - P(Style("flex: auto;"), Em(Title(article.Date.Format("Monday, January 2, 2006")), Text(article.Date.Format("Mon, 02 Jan 2006")))), - ), - ), - Main(Raw(article.Content)), - Footer(A(Href(fmt.Sprintf("https://git.jolheiser.com/blog/tree/%s/%s", ref, article.Path)), Text("source"))), - }...) -} - -func Property(property string) Node { - return Attr("property", property) -} diff --git a/main.go b/main.go index ccd2dcfbeeeb317462b5f0eaabf01be89c568092..923f70e2c86e9380566371d2768f93b28179dd9d 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,9 @@ +//go:generate templ generate //go:generate go run . package main import ( + "context" "embed" "flag" "fmt" @@ -12,8 +14,6 @@ "os" "path/filepath" "time" - "blog.jolheiser.com/article" - "blog.jolheiser.com/html" "github.com/alecthomas/chroma/v2/styles" "github.com/gorilla/feeds" ) @@ -23,8 +23,15 @@ //go:embed articles/* articleFS embed.FS //go:embed static/* staticFS embed.FS + ref string = "main" ) +func init() { + if r, ok := os.LookupEnv("BLOG_REF"); ok { + ref = r + } +} + func maine() error { fs := flag.NewFlagSet("blog", flag.ExitOnError) outFlag := fs.String("out", "out", "Output directory") @@ -40,8 +47,8 @@ if err != nil { return err } - categories := make(article.Articles) - articles := make([]article.Article, 0, len(files)) + categories := make(Articles) + articles := make([]Article, 0, len(files)) for _, file := range files { if filepath.Ext(file.Name()) != ".md" { continue @@ -51,11 +58,11 @@ content, err := iofs.ReadFile(articleFS, path) if err != nil { return err } - article, err := article.Parse(string(content)) + article, err := Parse(string(content)) if err != nil { return err } - article.Path = path + article.path = path categories[article.Category] = append(categories[article.Category], article) articles = append(articles, article) if err := writeArticle(*outFlag, article); err != nil { @@ -81,7 +88,7 @@ return err } defer fi.Close() - if err := html.IndexHTML(categories).Render(fi); err != nil { + if err := IndexTemplate(categories).Render(context.Background(), fi); err != nil { return err } @@ -94,7 +101,7 @@ return nil } -func writeArticle(out string, article article.Article) error { +func writeArticle(out string, article Article) error { dest := filepath.Join(out, article.Slug(), "index.html") if err := os.MkdirAll(filepath.Dir(dest), os.ModePerm); err != nil { return err @@ -106,10 +113,10 @@ return err } defer fi.Close() - return html.ArticleHTML(article).Render(fi) + return ArticleTemplate(article).Render(context.Background(), fi) } -func writeRSS(out string, articles []article.Article) error { +func writeRSS(out string, articles []Article) error { fi, err := os.Create(filepath.Join(out, "feed.atom")) if err != nil { return err @@ -126,6 +133,7 @@ Email: "john@jolheiser.com", }, Updated: time.Now(), Created: time.Date(2024, time.February, 25, 0, 0, 0, 0, time.Local), + // Image: &feeds.Image{}, } for _, article := range articles { if article.Draft { @@ -138,6 +146,7 @@ Link: &feeds.Link{Href: url}, Description: article.Summary, Id: url, Created: article.Date, + // Content: article.Content, }) } @@ -151,11 +160,11 @@ return err } defer fi.Close() - if err := article.CSS.WriteCSS(fi, styles.Get("catppuccin-latte")); err != nil { + if err := CSS.WriteCSS(fi, styles.Get("catppuccin-latte")); err != nil { return err } fi.WriteString("@media (prefers-color-scheme: dark) {") - if err := article.CSS.WriteCSS(fi, styles.Get("catppuccin-mocha")); err != nil { + if err := CSS.WriteCSS(fi, styles.Get("catppuccin-mocha")); err != nil { return err } fi.WriteString("}") diff --git a/templates.templ b/templates.templ new file mode 100644 index 0000000000000000000000000000000000000000..912542a625ac0847b82b52d54ad021328ea91716 --- /dev/null +++ b/templates.templ @@ -0,0 +1,64 @@ +package main + +import "fmt" + +templ baseTemplate(title, description string) { + + + + + + { title } + + + + + + + + + { children... } + + +} + +templ IndexTemplate(articles Articles) { + @baseTemplate("jolheiser's blog", "Hahaha yes.....YES!") { +
+

jolheiser

+

Just a guy living in the middle of nowhere who likes to hack on open-source.

+
+
+ for category, articles := range articles { + if Published(articles) > 0 { +

{ category }

+ + } + } +
+ } +} + +templ ArticleTemplate(article Article) { + @baseTemplate(article.Title, article.Summary) { +
+

jolheiser

+
+

{ article.Title }

+
+

{ article.Category }

+

{ article.Date.Format("Mon, 02 Jan 2006") }

+
+
+
+ @templ.Raw(article.Content) +
+ + } +} diff --git a/templates_templ.go b/templates_templ.go new file mode 100644 index 0000000000000000000000000000000000000000..265e3907885666585761805e55ee48fd6d4297af --- /dev/null +++ b/templates_templ.go @@ -0,0 +1,311 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.786 +package main + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import "fmt" + +func baseTemplate(title, description string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates.templ`, Line: 11, Col: 17} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func IndexTemplate(articles Articles) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

jolheiser

Just a guy living in the middle of nowhere who likes to hack on open-source.

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for category, articles := range articles { + if Published(articles) > 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var7 string + templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(category) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates.templ`, Line: 34, Col: 19} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = baseTemplate("jolheiser's blog", "Hahaha yes.....YES!").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func ArticleTemplate(article Article) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var10 := templ.GetChildren(ctx) + if templ_7745c5c3_Var10 == nil { + templ_7745c5c3_Var10 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var11 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

jolheiser


") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(article.Title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates.templ`, Line: 53, Col: 22} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var13 string + templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(article.Category) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates.templ`, Line: 55, Col: 48} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var15 string + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(article.Date.Format("Mon, 02 Jan 2006")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates.templ`, Line: 56, Col: 128} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.Raw(article.Content).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = baseTemplate(article.Title, article.Summary).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate