From 3d4f3a9a7718408152f20758e5060a0f9e2f9658 Mon Sep 17 00:00:00 2001 From: maddalax Date: Sat, 26 Oct 2024 09:14:33 -0500 Subject: [PATCH] remove unsafe --- examples/hackernews/partials/comments.go | 4 ++-- examples/hackernews/partials/sidebar.go | 2 +- examples/hackernews/partials/story.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/hackernews/partials/comments.go b/examples/hackernews/partials/comments.go index 95ce923..270959a 100644 --- a/examples/hackernews/partials/comments.go +++ b/examples/hackernews/partials/comments.go @@ -75,7 +75,7 @@ func Comment(item news.Comment, nesting int) *h.Element { h.Class("flex gap-1 items-center"), h.Div( h.Class("font-bold text-rose-500"), - h.UnsafeRaw(item.By), + h.Text(item.By), ), h.Div( h.Class("text-sm text-gray-600"), @@ -85,7 +85,7 @@ func Comment(item news.Comment, nesting int) *h.Element { ), h.Div( h.Class("text-sm text-gray-600"), - h.UnsafeRaw(strings.TrimSpace(item.Text)), + h.Text(strings.TrimSpace(item.Text)), ), ), h.If( diff --git a/examples/hackernews/partials/sidebar.go b/examples/hackernews/partials/sidebar.go index d3bbef0..8dbba45 100644 --- a/examples/hackernews/partials/sidebar.go +++ b/examples/hackernews/partials/sidebar.go @@ -142,7 +142,7 @@ var CachedStoryList = h.CachedPerKeyT4(time.Minute*5, func(category string, page h.Class("block p-2 bg-white rounded-md shadow cursor-pointer"), h.Div( h.Class("font-bold"), - h.UnsafeRaw(item.Title), + h.Text(item.Title), ), h.Div( h.Class("text-sm text-gray-600"), diff --git a/examples/hackernews/partials/story.go b/examples/hackernews/partials/story.go index 8b72272..4bea202 100644 --- a/examples/hackernews/partials/story.go +++ b/examples/hackernews/partials/story.go @@ -57,7 +57,7 @@ func StoryBody(story *news.Story) *h.Element { h.Class("prose prose-2xl border-b border-gray-200 pb-3 max-w-none w-full"), h.H5( h.Class("flex gap-2 items-left font-bold"), - h.UnsafeRaw(story.Title), + h.Text(story.Title), ), h.A( h.Href(story.Url), @@ -66,7 +66,7 @@ func StoryBody(story *news.Story) *h.Element { ), h.Div( h.Class("text-sm text-gray-600"), - h.UnsafeRaw(story.Text), + h.Text(story.Text), ), h.Div( h.Class("text-sm text-gray-600 mt-2"),