-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbasecontent.go
85 lines (72 loc) · 1.5 KB
/
basecontent.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Package ftmpl is generated with ftmpl {{{v0.3.1}}}, do not edit!!!! */
package ftmpl
import (
"bytes"
"errors"
"fmt"
"github.com/SlinSo/goTemplateBenchmark/model"
"html"
"os"
)
func init() {
_ = fmt.Sprintf
_ = errors.New
_ = os.Stderr
_ = html.EscapeString
}
// TMPLERRbasecontent evaluates a template basecontent.tmpl
func TMPLERRbasecontent(u *model.User, nav []*model.Navigation, title string) (string, error) {
_template := "basecontent.tmpl"
_escape := html.EscapeString
var _ftmpl bytes.Buffer
_w := func(str string) { _, _ = _ftmpl.WriteString(str) }
_, _, _ = _template, _escape, _w
_w(`
`)
_w(`<!DOCTYPE html>
<html>
<body>
<header>
`)
_w(`<title>`)
_w(fmt.Sprintf(`%s`, _escape(title)))
_w(`'s Home Page</title>
<div class="header">Page Header</div>
`)
_w(`</header>
<nav>
`)
_w(`<ul class="navigation">
`)
for _, item := range nav {
_w(`
<li><a href="`)
_w(fmt.Sprintf(`%s`, _escape(item.Link)))
_w(`">`)
_w(fmt.Sprintf(`%s`, _escape(item.Item)))
_w(`</a></li>
`)
}
_w(`
</ul>`)
_w(`</nav>
<section>
`)
_w(`</section>
<footer>
`)
_w(`<div class="footer">copyright 2016</div>
`)
_w(`</footer>
</body>
</html>`)
return _ftmpl.String(), nil
}
// TMPLbasecontent evaluates a template basecontent.tmpl
func TMPLbasecontent(u *model.User, nav []*model.Navigation, title string) string {
html, err := TMPLERRbasecontent(u, nav, title)
if err != nil {
_, _ = os.Stderr.WriteString("Error running template basecontent.tmpl:" + err.Error())
}
return html
}