2015-07-30 15:43:22 +00:00
|
|
|
package pongo2
|
|
|
|
|
2019-01-21 14:27:20 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2015-07-30 15:43:22 +00:00
|
|
|
type nodeHTML struct {
|
|
|
|
token *Token
|
2019-01-21 14:27:20 +00:00
|
|
|
trimLeft bool
|
|
|
|
trimRight bool
|
2015-07-30 15:43:22 +00:00
|
|
|
}
|
|
|
|
|
2017-12-28 01:56:23 +00:00
|
|
|
func (n *nodeHTML) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error {
|
2019-01-21 14:27:20 +00:00
|
|
|
res := n.token.Val
|
|
|
|
if n.trimLeft {
|
|
|
|
res = strings.TrimLeft(res, tokenSpaceChars)
|
|
|
|
}
|
|
|
|
if n.trimRight {
|
|
|
|
res = strings.TrimRight(res, tokenSpaceChars)
|
|
|
|
}
|
|
|
|
writer.WriteString(res)
|
2015-07-30 15:43:22 +00:00
|
|
|
return nil
|
|
|
|
}
|