From 0f09caaa54835ab8fd2adbb447064f0a313af785 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Wed, 19 Jul 2023 10:48:39 +0100 Subject: :recycle: Handle text escaping only when emitting a HTML string. --- src/lustre/element.gleam | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lustre/element.gleam b/src/lustre/element.gleam index 7f1479c..3a803dc 100644 --- a/src/lustre/element.gleam +++ b/src/lustre/element.gleam @@ -29,7 +29,7 @@ pub fn h( /// /// pub fn t(content: String) -> Element(msg) { - Text(escape("", content)) + Text(content) } fn escape(escaped: String, content: String) -> String { @@ -44,12 +44,6 @@ fn escape(escaped: String, content: String) -> String { } } -/// -/// -pub fn unescaped_text(content: String) -> Element(msg) { - Text(content) -} - // MANIPULATIONS --------------------------------------------------------------- /// @@ -79,7 +73,7 @@ pub fn to_string(element: Element(msg)) -> String { /// pub fn to_string_builder(element: Element(msg)) -> StringBuilder { case element { - Text(content) -> string_builder.from_string(content) + Text(content) -> string_builder.from_string(escape("", content)) Element(tag, attrs, children) -> { string_builder.from_string("<" <> tag) |> attrs_to_string_builder(attrs) -- cgit v1.2.3