diff options
Diffstat (limited to 'modules/templates/helper.go')
-rw-r--r-- | modules/templates/helper.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index ab66cc7282..7e33f26209 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -92,6 +92,7 @@ func NewFuncMap() []template.FuncMap { }, "Safe": Safe, "SafeJS": SafeJS, + "JSEscape": JSEscape, "Str2html": Str2html, "TimeSince": timeutil.TimeSince, "TimeSinceUnix": timeutil.TimeSinceUnix, @@ -629,6 +630,11 @@ func Escape(raw string) string { return html.EscapeString(raw) } +// JSEscape escapes a JS string +func JSEscape(raw string) string { + return template.JSEscapeString(raw) +} + // List traversings the list func List(l *list.List) chan interface{} { e := l.Front() |