From 6f1c0e8b20721048fb1273a4c88dbfb46e7cd89c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 1 Aug 2025 01:07:27 +0200 Subject: Rename function --- src/templates.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/templates.go') diff --git a/src/templates.go b/src/templates.go index 95956b0..a7d7f2a 100644 --- a/src/templates.go +++ b/src/templates.go @@ -28,13 +28,13 @@ var ( errorTmpl *template.Template templates map[string]*template.Template funcmap = map[string]any{ - "ifElse": ifElse, - "locales": i18n.Locales, - "map": templateMakeMap, - "safe": asHTML, - "toUpper": strings.ToUpper, - "tuple": templateMakeTuple, - "makeHeaderWithTranslations": makeHeaderWithTranslations, + "ifElse": ifElse, + "locales": i18n.Locales, + "map": templateMakeMap, + "safe": asHTML, + "toUpper": strings.ToUpper, + "tuple": templateMakeTuple, + "withTranslations": withTranslations, } ) @@ -133,8 +133,7 @@ func ifElse(b bool, x, y any) any { return y } -func makeHeaderWithTranslations(tag string, text string, - translations ...[]any) template.HTML { +func withTranslations(tag string, text string, translations ...[]any) template.HTML { var bob strings.Builder bob.WriteByte('<') bob.WriteString(tag) @@ -168,6 +167,10 @@ func (td templateData) Get(fmt string, args ...map[string]any) template.HTML { return template.HTML(td.Printer.Get(fmt, args...)) } +func (td templateData) GetC(fmt, ctx string, args ...map[string]any) template.HTML { + return template.HTML(td.Printer.GetC(fmt, ctx, args...)) +} + func (td templateData) GetN(fmtS, fmtP string, n int, args ...map[string]any) template.HTML { return template.HTML(td.Printer.GetN(fmtS, fmtP, n, args...)) } -- cgit v1.2.3