2018-01-28 14:56:30 +00:00
|
|
|
package pongo2
|
|
|
|
|
2019-04-21 17:58:15 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2018-01-28 14:56:30 +00:00
|
|
|
type nodeHTML struct {
|
|
|
|
token *Token
|
2019-04-21 17:58:15 +00:00
|
|
|
trimLeft bool
|
|
|
|
trimRight bool
|
2018-01-28 14:56:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n *nodeHTML) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error {
|
2019-04-21 17:58:15 +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)
|
2018-01-28 14:56:30 +00:00
|
|
|
return nil
|
|
|
|
}
|