MCPcopy Create free account
hub / github.com/CloudyKit/jet / String

Method String

node.go:420–444  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

418}
419
420func (b *BranchNode) String() string {
421
422 if b.NodeType == NodeRange {
423 s := ""
424 if b.Set != nil {
425 s = b.Set.String()
426 } else {
427 s = b.Expression.String()
428 }
429
430 if b.ElseList != nil {
431 return fmt.Sprintf("{{range %s}}%s{{else}}%s{{end}}", s, b.List, b.ElseList)
432 }
433 return fmt.Sprintf("{{range %s}}%s{{end}}", s, b.List)
434 } else {
435 s := ""
436 if b.Set != nil {
437 s = b.Set.String() + ";"
438 }
439 if b.ElseList != nil {
440 return fmt.Sprintf("{{if %s%s}}%s{{else}}%s{{end}}", s, b.Expression, b.List, b.ElseList)
441 }
442 return fmt.Sprintf("{{if %s%s}}%s{{end}}", s, b.Expression, b.List)
443 }
444}
445
446// IfNode represents an {{if}} action and its commands.
447type IfNode struct {

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected