diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-19 10:48:39 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-19 10:48:39 +0100 |
commit | 0f09caaa54835ab8fd2adbb447064f0a313af785 (patch) | |
tree | 583806a4e7a72315451464ac889a71227e1d6369 | |
parent | 42067167e278fef921a07addf974f2b278944222 (diff) | |
download | lustre-0f09caaa54835ab8fd2adbb447064f0a313af785.tar.gz lustre-0f09caaa54835ab8fd2adbb447064f0a313af785.zip |
:recycle: Handle text escaping only when emitting a HTML string.
-rw-r--r-- | src/lustre/element.gleam | 10 |
1 files changed, 2 insertions, 8 deletions
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) |