From 79a9ce612662338b7298cef67b9be21bcf001080 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Wed, 3 Feb 2021 10:44:39 +0100 Subject: [PATCH] Fix special characters in comments --- go.mod | 4 ++-- go.sum | 8 ++++---- render.go | 3 +++ templates/comment.gohtml | 2 +- templates/commentsadmin.gohtml | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index e6b7fb0..0b4869b 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/gofrs/flock v0.8.0 // indirect github.com/goodsign/monday v1.0.1-0.20201007115131-c065b60ec611 github.com/google/go-cmp v0.5.4 // indirect - github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect + github.com/gopherjs/gopherjs v0.0.0-20210202160940-bed99a852dfe // indirect github.com/gorilla/feeds v1.1.1 github.com/gorilla/handlers v1.5.1 github.com/hashicorp/golang-lru v0.5.4 @@ -34,7 +34,7 @@ require ( github.com/mattn/go-sqlite3 v1.14.6 github.com/mholt/acmez v0.1.3 // indirect github.com/microcosm-cc/bluemonday v1.0.4 - github.com/miekg/dns v1.1.37 // indirect + github.com/miekg/dns v1.1.38 // indirect github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/pelletier/go-toml v1.8.1 // indirect github.com/smartystreets/assertions v1.2.0 // indirect diff --git a/go.sum b/go.sum index 025bf1b..ec798ec 100644 --- a/go.sum +++ b/go.sum @@ -114,8 +114,8 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= -github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20210202160940-bed99a852dfe h1:rcf1P0fm+1l0EjG16p06mYLj9gW9X36KgdHJ/88hS4g= +github.com/gopherjs/gopherjs v0.0.0-20210202160940-bed99a852dfe/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/feeds v1.1.1 h1:HwKXxqzcRNg9to+BbvJog4+f3s/xzvtZXICcQGutYfY= @@ -224,8 +224,8 @@ github.com/microcosm-cc/bluemonday v1.0.4/go.mod h1:8iwZnFn2CDDNZ0r6UXhF4xawGvza github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.30 h1:Qww6FseFn8PRfw07jueqIXqodm0JKiiKuK0DeXSqfyo= github.com/miekg/dns v1.1.30/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.37 h1:+kky2ArpBqk0S/74RkwFjmKM9jja7AB1RN7VUuVq0iM= -github.com/miekg/dns v1.1.37/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.38 h1:MtIY+fmHUVVgv1AXzmKMWcwdCYxTRPG1EDjpqF4RCEw= +github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= diff --git a/render.go b/render.go index 523013f..5e40db8 100644 --- a/render.go +++ b/render.go @@ -61,6 +61,9 @@ func initRendering() error { } return template.HTML(htmlContent) }, + "html": func(s string) template.HTML { + return template.HTML(s) + }, // Post specific "p": func(p *post, parameter string) string { return p.firstParameter(parameter) diff --git a/templates/comment.gohtml b/templates/comment.gohtml index dd586d1..d2951a3 100644 --- a/templates/comment.gohtml +++ b/templates/comment.gohtml @@ -10,7 +10,7 @@ {{ if .Data.Website }}{{ .Data.Name }}{{ else }}{{ .Data.Name }}{{ end }}:
- {{ .Data.Comment }} + {{ html .Data.Comment }}
{{ end }} diff --git a/templates/commentsadmin.gohtml b/templates/commentsadmin.gohtml index baf757a..5673cdf 100644 --- a/templates/commentsadmin.gohtml +++ b/templates/commentsadmin.gohtml @@ -12,7 +12,7 @@ Target: {{ $comment.Target }}
Name: {{ $comment.Name }}
Website: {{ $comment.Website }}
- Comment: {{ $comment.Comment }} + Comment: {{ html $comment.Comment }}