File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import (
27
27
"golang.org/x/net/html/charset"
28
28
"golang.org/x/text/transform"
29
29
"gopkg.in/editorconfig/editorconfig-core-go.v1"
30
+ "html"
30
31
)
31
32
32
33
// NewFuncMap returns functions for injecting to templates
@@ -179,6 +180,7 @@ func NewFuncMap() []template.FuncMap {
179
180
return dict , nil
180
181
},
181
182
"Printf" : fmt .Sprintf ,
183
+ "Escape" : Escape ,
182
184
}}
183
185
}
184
186
@@ -197,6 +199,11 @@ func Str2html(raw string) template.HTML {
197
199
return template .HTML (markup .Sanitize (raw ))
198
200
}
199
201
202
+ // Escape escapes a HTML string
203
+ func Escape (raw string ) string {
204
+ return html .EscapeString (raw )
205
+ }
206
+
200
207
// List traversings the list
201
208
func List (l * list.List ) chan interface {} {
202
209
e := l .Front ()
Original file line number Diff line number Diff line change 14
14
</div>
15
15
{{if .Keyword}}
16
16
<h3>
17
- {{.i18n.Tr "repo.search.results" .Keyword .RepoLink .RepoName | Str2html}}
17
+ {{.i18n.Tr "repo.search.results" ( .Keyword|Escape) .RepoLink .RepoName | Str2html }}
18
18
</h3>
19
19
<div class="repository search">
20
20
{{range $result := .SearchResults}}
You can’t perform that action at this time.
0 commit comments