7
7
"github.com/docker-library/go-dockerlibrary/pkg/templatelib"
8
8
)
9
9
10
- func Example_FuncMapPrefixSuffix () {
10
+ func Example_prefixSuffix () {
11
11
tmpl , err := template .New ("github-or-html" ).Funcs (templatelib .FuncMap ).Parse (`
12
12
{{- . -}}
13
13
@@ -52,7 +52,7 @@ func Example_FuncMapPrefixSuffix() {
52
52
// https://github.com/example/example/raw/master/test.html GitHub HTML
53
53
}
54
54
55
- func Example_FuncMapTernary () {
55
+ func Example_ternary () {
56
56
tmpl , err := template .New ("huge-if-true" ).Funcs (templatelib .FuncMap ).Parse (`
57
57
{{- range $a := . -}}
58
58
{{ printf "%#v: %s\n" $a (ternary "HUGE" "not so huge" $a) }}
@@ -90,7 +90,7 @@ func Example_FuncMapTernary() {
90
90
// []bool{false}: HUGE
91
91
}
92
92
93
- func Example_FuncMapFirstLast () {
93
+ func Example_firstLast () {
94
94
tmpl , err := template .New ("first-and-last" ).Funcs (templatelib .FuncMap ).Parse (`First: {{ . | first }}, Last: {{ . | last }}` )
95
95
96
96
err = tmpl .Execute (os .Stdout , []interface {}{
@@ -106,7 +106,7 @@ func Example_FuncMapFirstLast() {
106
106
// First: a, Last: c
107
107
}
108
108
109
- func Example_FuncMapJson () {
109
+ func Example_json () {
110
110
tmpl , err := template .New ("json" ).Funcs (templatelib .FuncMap ).Parse (`
111
111
{{- json . -}}
112
112
` )
@@ -124,7 +124,7 @@ func Example_FuncMapJson() {
124
124
// {"a":["1","2","3"],"b":{"1":true,"2":false,"3":true},"c":null}
125
125
}
126
126
127
- func Example_FuncMapJoin () {
127
+ func Example_join () {
128
128
tmpl , err := template .New ("join" ).Funcs (templatelib .FuncMap ).Parse (`
129
129
Array: {{ . | join ", " }}{{ "\n" -}}
130
130
Args: {{ join ", " "a" "b" "c" -}}
@@ -144,7 +144,7 @@ func Example_FuncMapJoin() {
144
144
// Args: a, b, c
145
145
}
146
146
147
- func Example_FuncMapTrimReplaceGitToHttps () {
147
+ func Example_trimReplaceGitToHttps () {
148
148
tmpl , err := template .New ("git-to-https" ).Funcs (templatelib .FuncMap ).Parse (`
149
149
{{- range . -}}
150
150
{{- . | replace "git://" "https://" | trimSuffixes ".git" }}{{ "\n" -}}
@@ -166,7 +166,7 @@ func Example_FuncMapTrimReplaceGitToHttps() {
166
166
// https://github.com/jsmith/some-repo
167
167
}
168
168
169
- func Example_FuncMapTrimReplaceGitToGo () {
169
+ func Example_trimReplaceGitToGo () {
170
170
tmpl , err := template .New ("git-to-go" ).Funcs (templatelib .FuncMap ).Parse (`
171
171
{{- range . -}}
172
172
{{- . | trimPrefixes "git://" "http://" "https://" "ssh://" | trimSuffixes ".git" }}{{ "\n" -}}
0 commit comments