From e6c738f33cf85854e5be14f7d3f190be8622eb0a Mon Sep 17 00:00:00 2001 From: stephann <3025661+stephannv@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:32:16 -0300 Subject: [PATCH] Expose `styles` method --- lib/phlex/sgml.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/phlex/sgml.rb b/lib/phlex/sgml.rb index 4d686171..77ff3a0f 100644 --- a/lib/phlex/sgml.rb +++ b/lib/phlex/sgml.rb @@ -267,6 +267,10 @@ def after_template nil end + def styles(value) + __styles__(value).gsub('"', """) + end + def __yield_content__ return unless block_given? @@ -372,21 +376,21 @@ def __attributes__(attributes, buffer = +"") when Hash case k when :style - __styles__(v).gsub('"', """) + styles(v) else __nested_attributes__(v, "#{name}-", buffer) end when Array case k when :style - __styles__(v).gsub('"', """) + styles(v) else __nested_tokens__(v) end when Set case k when :style - __styles__(v).gsub('"', """) + styles(v) else __nested_tokens__(v.to_a) end