From ac12cd52e17d515cc5cd260d204451c6dbcb3735 Mon Sep 17 00:00:00 2001
From: Semyon Krestyaninov <krestyaninov@perx.ru>
Date: Wed, 11 Jun 2025 12:59:39 +0300
Subject: [PATCH] add comment

---
 template/builder.go | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/template/builder.go b/template/builder.go
index a92e8ca3..c6066226 100644
--- a/template/builder.go
+++ b/template/builder.go
@@ -18,8 +18,6 @@ type Template interface {
 }
 
 type Builder struct {
-	parseFunc func(data string) (Template, error)
-
 	ctx     context.Context
 	cnt     *content.Content
 	SpaceID string
@@ -31,6 +29,9 @@ type Builder struct {
 	space       *spaces.Space
 	environment *environments.Environment
 	collection  *collections.Collection
+
+	// templateFunc парсит строку и возвращает шаблон для подстановки значений
+	templateFunc func(data string) (Template, error)
 }
 
 func NewBuilder(cnt *content.Content, space, env, col string) Builder {
@@ -41,7 +42,7 @@ func NewBuilder(cnt *content.Content, space, env, col string) Builder {
 		EnvID:   env,
 		CollID:  col,
 	}
-	b.parseFunc = func(data string) (Template, error) {
+	b.templateFunc = func(data string) (Template, error) {
 		return text.New("main_text").Funcs(b.getFuncs()).Parse(data)
 	}
 	return b
@@ -55,7 +56,7 @@ func NewHTMLBuilder(cnt *content.Content, space, env, col string) Builder {
 		EnvID:   env,
 		CollID:  col,
 	}
-	b.parseFunc = func(data string) (Template, error) {
+	b.templateFunc = func(data string) (Template, error) {
 		return html.New("main_html").Funcs(b.getFuncs()).Parse(data)
 	}
 	return b
@@ -112,7 +113,7 @@ func (b *Builder) Context() context.Context {
 
 func (b *Builder) Execute(str string, data ...any) (string, error) {
 	buf := new(bytes.Buffer)
-	t, err := b.parseFunc(str)
+	t, err := b.templateFunc(str)
 	if err != nil {
 		return "", err
 	}
@@ -129,7 +130,7 @@ func (b *Builder) ExecuteList(str []string, data ...any) ([]string, error) {
 		if tmpl == "" {
 			continue
 		}
-		t, err := b.parseFunc(tmpl)
+		t, err := b.templateFunc(tmpl)
 		if err != nil {
 			return []string{}, err
 		}
-- 
GitLab