Browse Source

Add html escape function so it can be invoked from template (#2451)

Laurence Jones 1 năm trước cách đây
mục cha
commit
aff80a2863
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      pkg/csplugin/helpers.go

+ 3 - 1
pkg/csplugin/helpers.go

@@ -1,6 +1,7 @@
 package csplugin
 package csplugin
 
 
 import (
 import (
+	"html"
 	"os"
 	"os"
 	"text/template"
 	"text/template"
 
 
@@ -28,7 +29,8 @@ var helpers = template.FuncMap{
 		}
 		}
 		return ret
 		return ret
 	},
 	},
-	"Hostname": os.Hostname,
+	"Hostname":   os.Hostname,
+	"HTMLEscape": html.EscapeString,
 }
 }
 
 
 func funcMap() template.FuncMap {
 func funcMap() template.FuncMap {