Просмотр исходного кода

refactor(template): rename noescape to safeHTML

This makes the code more consistent, since all the other escaping escape
hatches have a `safe` prefix.
jvoisin 10 месяцев назад
Родитель
Сommit
4f252b33c9
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      internal/template/functions.go
  2. 2 2
      internal/template/templates/views/entry.html

+ 1 - 1
internal/template/functions.go

@@ -60,7 +60,7 @@ func (f *funcMap) Map() template.FuncMap {
 		"safeJS": func(str string) template.JS {
 			return template.JS(str)
 		},
-		"noescape": func(str string) template.HTML {
+		"safeHTML": func(str string) template.HTML {
 			return template.HTML(str)
 		},
 		"proxyFilter": func(data string) string {

+ 2 - 2
internal/template/templates/views/entry.html

@@ -280,9 +280,9 @@
     {{ end }}
 
     {{ if .user }}
-        {{ noescape (proxyFilter .entry.Content) }}
+        {{ safeHTML (proxyFilter .entry.Content) }}
     {{ else }}
-        {{ noescape .entry.Content }}
+        {{ safeHTML .entry.Content }}
     {{ end }}
 </article>
 {{ if .entry.Enclosures }}