2015-09-04 14:27:44 +00:00
|
|
|
package pongo2
|
|
|
|
|
2018-06-04 09:29:58 +00:00
|
|
|
import (
|
2018-06-04 10:18:55 +00:00
|
|
|
"strings"
|
2018-06-04 09:29:58 +00:00
|
|
|
)
|
|
|
|
|
2015-09-04 14:27:44 +00:00
|
|
|
type nodeHTML struct {
|
|
|
|
token *Token
|
2018-06-04 10:18:55 +00:00
|
|
|
trimLeft bool
|
|
|
|
trimRight bool
|
2015-09-04 14:27:44 +00:00
|
|
|
}
|
|
|
|
|
2018-06-04 10:18:55 +00:00
|
|
|
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)
|
2015-09-04 14:27:44 +00:00
|
|
|
return nil
|
|
|
|
}
|