From 2485f657472076f0f27ce578d6439e351d206512 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Tue, 17 Oct 2023 14:44:41 +0600 Subject: [PATCH] :label: Created Content domain with HTML and plaintext content support --- internal/domain/content.go | 8 ++++++++ internal/domain/entry.go | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 internal/domain/content.go diff --git a/internal/domain/content.go b/internal/domain/content.go new file mode 100644 index 0000000..2b63ec6 --- /dev/null +++ b/internal/domain/content.go @@ -0,0 +1,8 @@ +package domain + +import "golang.org/x/net/html" + +type Content struct { + HTML *html.Node + Text string +} diff --git a/internal/domain/entry.go b/internal/domain/entry.go index 8de6518..ca8662d 100644 --- a/internal/domain/entry.go +++ b/internal/domain/entry.go @@ -13,7 +13,7 @@ type Entry struct { DeletedAt time.Time Title string // p-name Description string // p-summary - Content []byte // e-content + Content Content // e-content PublishedAt time.Time // dt-published UpdatedAt time.Time // dt-updated // TODO(toby3d): Author string // p-author @@ -59,11 +59,11 @@ func TestEntry(tb testing.TB) *Entry { Title: "Lorem ipsum", Description: "Ut enim ad minim veniam, quis nostrud exercitation " + "ullamco laboris nisi ut aliquip ex ea commodo consequat.", - Content: []byte("Duis aute irure dolor in reprehenderit in " + + Content: Content{Text: "Duis aute irure dolor in reprehenderit in " + "voluptate velit esse cillum dolore eu fugiat nulla " + "pariatur. Excepteur sint occaecat cupidatat non proident," + " sut in culpa qui officia deserunt mollit anim id est " + - "laborum."), + "laborum."}, Tags: []string{"lorem", "ipsum", "dor"}, } }