Skip to content

Commit

Permalink
Restore safe values should be raw (#854)
Browse files Browse the repository at this point in the history
#792 added this feature, but
#846 removed it. This restores
the ability to render safe content without needing to call `raw`.

Fixes #851
  • Loading branch information
davekaro authored Feb 12, 2025
1 parent 6dd6864 commit fca8fc4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/phlex/sgml/elements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def #{method_name}(**attributes)
content = yield(self)
if original_length == buffer.bytesize
case content
when nil
nil
when ::Phlex::SGML::SafeObject
buffer << content.to_s
when String
buffer << ::Phlex::Escape.html_escape(content)
when Symbol
buffer << ::Phlex::Escape.html_escape(content.name)
when ::Phlex::SGML::SafeObject
buffer << content.to_s
when nil
nil
else
if (formatted_object = format_object(content))
buffer << ::Phlex::Escape.html_escape(formatted_object)
Expand All @@ -54,14 +54,14 @@ def #{method_name}(**attributes)
content = yield(self)
if original_length == buffer.bytesize
case content
when nil
nil
when ::Phlex::SGML::SafeObject
buffer << content.to_s
when String
buffer << ::Phlex::Escape.html_escape(content)
when Symbol
buffer << ::Phlex::Escape.html_escape(content.name)
when ::Phlex::SGML::SafeObject
buffer << content.to_s
when nil
nil
else
if (formatted_object = format_object(content))
buffer << ::Phlex::Escape.html_escape(formatted_object)
Expand Down

0 comments on commit fca8fc4

Please sign in to comment.