Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagab committed Sep 25, 2024
1 parent 739cb8d commit 8cb4b58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def __text__(content)
return true if context.fragments && !context.in_target_fragment

case content
when Phlex::SGML::SafeObject
context.buffer << content.to_s
when String
context.buffer << Phlex::Escape.html_escape(content)
when Symbol
Expand Down
8 changes: 4 additions & 4 deletions lib/phlex/sgml/elements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def #{method_name}(**attributes)
content = yield(self)
if original_length == buffer.bytesize
case content
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 nil
nil
when ::Phlex::SGML::SafeObject
buffer << content.to_s
else
if (formatted_object = format_object(content))
buffer << ::Phlex::Escape.html_escape(formatted_object)
Expand All @@ -67,14 +67,14 @@ def #{method_name}(**attributes)
content = yield(self)
if original_length == buffer.bytesize
case content
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 nil
nil
when ::Phlex::SGML::SafeObject
buffer << content.to_s
else
if (formatted_object = format_object(content))
buffer << ::Phlex::Escape.html_escape(formatted_object)
Expand Down

0 comments on commit 8cb4b58

Please sign in to comment.