File: nodes_html.go

package info (click to toggle)
golang-github-flosch-pongo2.v4 4.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, trixie
  • size: 860 kB
  • sloc: makefile: 3
file content (23 lines) | stat: -rw-r--r-- 392 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package pongo2

import (
	"strings"
)

type nodeHTML struct {
	token     *Token
	trimLeft  bool
	trimRight bool
}

func (n *nodeHTML) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error {
	res := n.token.Val
	if n.trimLeft {
		res = strings.TrimLeft(res, tokenSpaceChars)
	}
	if n.trimRight {
		res = strings.TrimRight(res, tokenSpaceChars)
	}
	writer.WriteString(res)
	return nil
}