Skip to content

Commit

Permalink
Remove tag
Browse files Browse the repository at this point in the history
This was broken and I think we should add it back as a point release.
  • Loading branch information
joeldrapper committed Sep 19, 2024
1 parent dae287c commit 74bf5dd
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,32 +181,12 @@ def capture(*args, &block)
end
end

def tag(name, ...)
normalized_name = case name
when Symbol then name.name.downcase
when String then name.downcase
else raise Phlex::ArgumentError.new("Expected the tag name as a Symbol or String.")
end

if normalized_name == "script"
raise Phlex::ArgumentError.new("You can’t use the `<script>` tag from the `tag` method. Use `unsafe_tag` instead, but be careful if using user input.")
end

if __registered_elements__[normalized_name]
public_send(normalized_name, ...)
else
raise Phlex::ArgumentError.new("Unknown tag: #{normalized_name}")
end
end

def safe(value)
case value
when String
Phlex::SGML::SafeValue.new(value)
when Symbol
Phlex::SGML::SafeValue.new(value.to_s)
else
raise Phlex::ArgumentError.new("Expected a String or Symbol.")
raise Phlex::ArgumentError.new("Expected a String.")
end
end

Expand Down

0 comments on commit 74bf5dd

Please sign in to comment.