-
Notifications
You must be signed in to change notification settings - Fork 3
/
javascript.goht.go
44 lines (39 loc) · 1.13 KB
/
javascript.goht.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Code generated by GoHT - DO NOT EDIT.
// https://github.com/stackus/goht
package main
import "context"
import "io"
import "github.com/stackus/goht"
// You can include JavaScript into your templates using the JavaScript
// filter `:javascript`. You may include interpolation values within
// the JavaScript code to have them replaced with values at render time.
var name = "Bob"
func JavaScript() goht.Template {
return goht.TemplateFunc(func(ctx context.Context, __w io.Writer) (__err error) {
__buf, __isBuf := __w.(goht.Buffer)
if !__isBuf {
__buf = goht.GetBuffer()
defer goht.ReleaseBuffer(__buf)
}
var __children goht.Template
ctx, __children = goht.PopChildren(ctx)
_ = __children
if _, __err = __buf.WriteString("<script>\nconsole.log(\"Hello "); __err != nil {
return
}
var __var1 string
if __var1, __err = goht.CaptureErrors(goht.EscapeString(name)); __err != nil {
return
}
if _, __err = __buf.WriteString(__var1); __err != nil {
return
}
if _, __err = __buf.WriteString("!\");\n</script>"); __err != nil {
return
}
if !__isBuf {
_, __err = __w.Write(__buf.Bytes())
}
return
})
}