Skip to content

Commit

Permalink
Automated commit by Forgejo CI/CD [v1.4.0] - Personal CI/CD Bot
Browse files Browse the repository at this point in the history
  • Loading branch information
poniatowski-bot committed Jan 11, 2024
1 parent 5355423 commit 3b6d184
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.4.0
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module zehd-frontend

go 1.21.3

toolchain go1.21.4
go 1.21.5

require (
github.com/aws/smithy-go v1.12.1
Expand All @@ -15,4 +13,7 @@ require (
github.com/russross/blackfriday/v2 v2.1.0
)

require golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect
require (
github.com/APoniatowski/funcmytemplate v0.0.1 // indirect
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/APoniatowski/boillog v1.1.0 h1:jceyfIZCuGSn4e3Rlo0JOXK6C46Gce6MpITowkbeX1E=
github.com/APoniatowski/boillog v1.1.0/go.mod h1:c7PpNRmlFv6tFVu9ogT/i1VwGsOeWRY8gRX14yHYpRQ=
github.com/APoniatowski/funcmytemplate v0.0.1 h1:iuMga0N5U4umc28iucvy0oPFlW7JCyrT8l7Z9xMsvwU=
github.com/APoniatowski/funcmytemplate v0.0.1/go.mod h1:d6IWMKOFbDyEPb46miTukA2c/4yHFahDC9wm5e/6EOE=
github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag=
github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
23 changes: 12 additions & 11 deletions pkg/caching/cachingHelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/APoniatowski/boillog"
"github.com/APoniatowski/funcmytemplate"

"github.com/gomarkdown/markdown"
"github.com/russross/blackfriday/v2"
Expand All @@ -15,13 +16,13 @@ import (
// pageBuilder Private helper function that builds HTML/goHTML pages and returns the templates
func pageBuilder(templatePath, layoutPath string) (*template.Template, error) {
defer boillog.TrackTime("page-builder", time.Now())
funcmytemplate := template.FuncMap{} // TODO: add funcmytemplate here later
funcmytemplates := funcmytemplate.Add()
templates := template.New("")
_, err := os.Stat(layoutPath)
if err != nil || !os.IsNotExist(err) {
templates, err = templates.Funcs(funcmytemplate).ParseFiles(templatePath)
templates, err = templates.Funcs(funcmytemplates).ParseFiles(templatePath)
} else {
templates, err = templates.Funcs(funcmytemplate).ParseFiles(layoutPath, templatePath)
templates, err = templates.Funcs(funcmytemplates).ParseFiles(layoutPath, templatePath)
}
if err != nil {
return nil, err
Expand All @@ -33,7 +34,7 @@ func pageBuilder(templatePath, layoutPath string) (*template.Template, error) {
func convertOrgToTemplate(orgPath, layoutPath string) (*template.Template, error) {
defer boillog.TrackTime("org-converter", time.Now())
var err error
funcmytemplate := template.FuncMap{} // TODO: add funcmytemplate here later
funcmytemplates := funcmytemplate.Add()
templates := template.New("")
_, notFoundErr := os.Stat(layoutPath)
if notFoundErr != nil {
Expand All @@ -44,7 +45,7 @@ func convertOrgToTemplate(orgPath, layoutPath string) (*template.Template, error
htmlBytes := blackfriday.Run(orgBytes)
html := string(htmlBytes)
html = fmt.Sprintf(`{{define "org"}}%s{{end}}`, html)
templates, err = templates.Funcs(funcmytemplate).Parse(html)
templates, err = templates.Funcs(funcmytemplates).Parse(html)
if err != nil {
return nil, err
}
Expand All @@ -56,8 +57,8 @@ func convertOrgToTemplate(orgPath, layoutPath string) (*template.Template, error
htmlBytes := blackfriday.Run(orgBytes)
html := string(htmlBytes)
html = fmt.Sprintf(`{{define "org"}}%s{{end}}`, html)
templates, err = templates.Funcs(funcmytemplate).ParseFiles(layoutPath)
templates, err = templates.Funcs(funcmytemplate).Parse(html)
templates, err = templates.Funcs(funcmytemplates).ParseFiles(layoutPath)
templates, err = templates.Funcs(funcmytemplates).Parse(html)
}
if err != nil {
return nil, err
Expand All @@ -69,7 +70,7 @@ func convertOrgToTemplate(orgPath, layoutPath string) (*template.Template, error
func convertMarkdownToTemplate(markdownPath, layoutPath string) (*template.Template, error) {
defer boillog.TrackTime("md-converter", time.Now())
var err error
funcmytemplate := template.FuncMap{} // TODO: add funcmytemplate here later
funcmytemplates := funcmytemplate.Add()
templates := template.New("")
_, notFoundErr := os.Stat(layoutPath)
if notFoundErr != nil {
Expand All @@ -79,7 +80,7 @@ func convertMarkdownToTemplate(markdownPath, layoutPath string) (*template.Templ
}
html := string(markdown.ToHTML(markdownBytes, nil, nil))
html = fmt.Sprintf(`{{define "markdown"}}%s{{end}}`, html)
templates, err = templates.Funcs(funcmytemplate).Parse(html)
templates, err = templates.Funcs(funcmytemplates).Parse(html)
if err != nil {
return nil, err
}
Expand All @@ -90,8 +91,8 @@ func convertMarkdownToTemplate(markdownPath, layoutPath string) (*template.Templ
}
html := string(markdown.ToHTML(markdownBytes, nil, nil))
html = fmt.Sprintf(`{{define "markdown"}}%s{{end}}`, html)
templates, err = templates.Funcs(funcmytemplate).ParseFiles(layoutPath)
templates, err = templates.Funcs(funcmytemplate).Parse(html)
templates, err = templates.Funcs(funcmytemplates).ParseFiles(layoutPath)
templates, err = templates.Funcs(funcmytemplates).Parse(html)
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 3b6d184

Please sign in to comment.