From 068f61dc2c2f35b1786f9dd09492f56e03981010 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Tue, 15 Oct 2024 20:03:09 +0200 Subject: [PATCH] Simplify NewText --- text.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/text.go b/text.go index 860e0b0..0f67192 100644 --- a/text.go +++ b/text.go @@ -12,8 +12,8 @@ type Text interface { func NewText(textType, content string) (Text, error) { switch textType { - case "text": - return &PlainText{Type: textType, Text: content}, nil + case "text", "": + return &PlainText{Type: "text", Text: content}, nil case "html": return &PlainText{Type: textType, Text: html.EscapeString(content)}, nil case "xhtml": @@ -24,8 +24,6 @@ func NewText(textType, content string) (Text, error) { Content: content, }, }, nil - case "": - return &PlainText{Type: "text", Text: content}, nil default: return nil, fmt.Errorf("%v is not a valid text type", textType) }