github.com/gogf/gf@v1.16.9/.example/os/gview/build_in_funcs/issue359-2.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/gogf/gf/frame/g" 7 ) 8 9 func main() { 10 s := "我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人我是中国人" 11 tplContent := ` 12 {{.str | strlimit 10 "..."}} 13 ` 14 content, err := g.View().ParseContent(tplContent, g.Map{ 15 "str": s, 16 }) 17 fmt.Println(err) 18 fmt.Println(content) 19 }