mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
@@ -20,11 +20,13 @@ import (
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"unicode"
|
||||
|
||||
bp "github.com/gohugoio/hugo/bufferpool"
|
||||
"github.com/gohugoio/hugo/common/hcontext"
|
||||
"github.com/gohugoio/hugo/identity"
|
||||
"github.com/gohugoio/hugo/langs"
|
||||
"github.com/gohugoio/hugo/output/layouts"
|
||||
|
||||
"github.com/gohugoio/hugo/output"
|
||||
@@ -160,6 +162,11 @@ type TemplateFuncGetter interface {
|
||||
GetFunc(name string) (reflect.Value, bool)
|
||||
}
|
||||
|
||||
type RenderingContext struct {
|
||||
Site site
|
||||
SiteOutIdx int
|
||||
}
|
||||
|
||||
type contextKey string
|
||||
|
||||
// Context manages values passed in the context to templates.
|
||||
@@ -191,6 +198,15 @@ type page interface {
|
||||
IsNode() bool
|
||||
}
|
||||
|
||||
type site interface {
|
||||
Language() *langs.Language
|
||||
}
|
||||
|
||||
const (
|
||||
HugoDeferredTemplatePrefix = "__hdeferred/"
|
||||
HugoDeferredTemplateSuffix = "__d="
|
||||
)
|
||||
|
||||
const hugoNewLinePlaceholder = "___hugonl_"
|
||||
|
||||
var stripHTMLReplacerPre = strings.NewReplacer("\n", " ", "</p>", hugoNewLinePlaceholder, "<br>", hugoNewLinePlaceholder, "<br />", hugoNewLinePlaceholder)
|
||||
@@ -228,3 +244,13 @@ func StripHTML(s string) string {
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
type DeferredExecution struct {
|
||||
Mu sync.Mutex
|
||||
Ctx context.Context
|
||||
TemplateName string
|
||||
Data any
|
||||
|
||||
Executed bool
|
||||
Result string
|
||||
}
|
||||
|
Reference in New Issue
Block a user