mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
tpl: Add templates.Current
This commit also * Unexport all internal state in TemplateInfo. * Make the dispatcher keys used for passing context.Context into uint8 from string to save memory allocations. Co-authored-by: Joe Mooring <joe@mooring.com> Updates #13571
This commit is contained in:
@@ -263,7 +263,7 @@ func (c *templateTransformContext) hasIdent(idents []string, ident string) bool
|
||||
//
|
||||
// {{ $_hugo_config:= `{ "version": 1 }` }}
|
||||
func (c *templateTransformContext) collectConfig(n *parse.PipeNode) {
|
||||
if c.t.Category != CategoryShortcode {
|
||||
if c.t.category != CategoryShortcode {
|
||||
return
|
||||
}
|
||||
if c.configChecked {
|
||||
@@ -304,7 +304,7 @@ func (c *templateTransformContext) collectConfig(n *parse.PipeNode) {
|
||||
// collectInner determines if the given CommandNode represents a
|
||||
// shortcode call to its .Inner.
|
||||
func (c *templateTransformContext) collectInner(n *parse.CommandNode) {
|
||||
if c.t.Category != CategoryShortcode {
|
||||
if c.t.category != CategoryShortcode {
|
||||
return
|
||||
}
|
||||
if c.t.ParseInfo.IsInner || len(n.Args) == 0 {
|
||||
@@ -328,7 +328,7 @@ func (c *templateTransformContext) collectInner(n *parse.CommandNode) {
|
||||
}
|
||||
|
||||
func (c *templateTransformContext) collectReturnNode(n *parse.CommandNode) bool {
|
||||
if c.t.Category != CategoryPartial || c.returnNode != nil {
|
||||
if c.t.category != CategoryPartial || c.returnNode != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user