Repository: yippee-fun/phlex (ruby)

Issue:
Attribute values being converted to HTML entities (when they should not)
If there's a need to add inline style, with background property

```ruby
class Nav < Phlex::HTML
  def template
    nav(class: "main-nav", style: "background: url('foo.jpg') no-repeat center center / cover;") {
      ul {
        li { a(href: "/") { "Home" } }
        li { a(href: "/about") { "About" } }
        li { a(href: "/contact") { "Contact" } }
      }
    }
  end
end
```

it's generating this HTML (indented for reading)

```html
<nav class="main-nav" style="background: url(&#39;foo.jpg&#39;) no-repeat center center / cover;">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/about">About</a></li>
    <li><a href="/contact">Contact</a></li>
  </ul>
</nav>
```

where the `background: url(&#39;foo.jpg&#39;)` should *not* be transformed into html entities

any suggestion?

thank you

ps: running Phlex 1.10.1


Discussion:
oii @fernandes 
While [single (and double) quotes are allowed](https://developer.mozilla.org/en-US/docs/Web/CSS/url), you can also omit them, and off the top of my head I think I usually see the quotes omitted.  So yes this looks like a bug, but I expect that you can easily work around it just by omitting the single quotation marks.


Patch:
diff --git a/lib/phlex/sgml.rb b/lib/phlex/sgml.rb
--- a/lib/phlex/sgml.rb
+++ b/lib/phlex/sgml.rb
@@ -393,9 +393,9 @@ def __attributes__(attributes, buffer = +"")
 				when true
 					buffer << " " << name
 				when String
-					buffer << " " << name << '="' << Phlex::Escape.html_escape(v) << '"'
+					buffer << " " << name << '="' << v.gsub('"', "&quot;") << '"'
 				when Symbol
-					buffer << " " << name << '="' << Phlex::Escape.html_escape(v.name) << '"'
+					buffer << " " << name << '="' << v.name.gsub('"', "&quot;") << '"'
 				when Integer, Float
 					buffer << " " << name << '="' << v.to_s << '"'
 				when Hash
@@ -408,9 +408,9 @@ def __attributes__(attributes, buffer = +"")
 						}, buffer
 					)
 				when Array
-					buffer << " " << name << '="' << Phlex::Escape.html_escape(v.compact.join(" ")) << '"'
+					buffer << " " << name << '="' << v.compact.join(" ").gsub('"', "&quot;") << '"'
 				when Set
-					buffer << " " << name << '="' << Phlex::Escape.html_escape(v.to_a.compact.join(" ")) << '"'
+					buffer << " " << name << '="' << v.to_a.compact.join(" ").gsub('"', "&quot;") << '"'
 				else
 					value = if v.respond_to?(:to_phlex_attribute_value)
 						v.to_phlex_attribute_value
@@ -420,7 +420,7 @@ def __attributes__(attributes, buffer = +"")
 						v.to_s
 					end
 
-					buffer << " " << name << '="' << Phlex::Escape.html_escape(value) << '"'
+					buffer << " " << name << '="' << value.gsub('"', "&quot;") << '"'
 				end
 			end
 


Test patch:
diff --git a/test/phlex/view/capture.rb b/test/phlex/view/capture.rb
--- a/test/phlex/view/capture.rb
+++ b/test/phlex/view/capture.rb
@@ -92,13 +92,13 @@ def view_template
 		end
 
 		it "should contain the full capture" do
-			expect(example.call(view_context: self)).to be == %(<h1>Before</h1><iframe srcdoc="&lt;h1&gt;Hello&lt;/h1&gt;&lt;h1&gt;World&lt;/h1&gt;"></iframe><h1>After</h1>)
+			expect(example.call(view_context: self)).to be == %(<h1>Before</h1><iframe srcdoc="<h1>Hello</h1><h1>World</h1>"></iframe><h1>After</h1>)
 		end
 
 		it "should contain the full capture if the buffer is provided" do
 			my_buffer = +""
 			example.call(my_buffer, view_context: self)
-			expect(my_buffer).to be == %(<h1>Before</h1><iframe srcdoc="&lt;h1&gt;Hello&lt;/h1&gt;&lt;h1&gt;World&lt;/h1&gt;"></iframe><h1>After</h1>)
+			expect(my_buffer).to be == %(<h1>Before</h1><iframe srcdoc="<h1>Hello</h1><h1>World</h1>"></iframe><h1>After</h1>)
 		end
 	end
 end
diff --git a/test/phlex/view/naughty_business.rb b/test/phlex/view/naughty_business.rb
--- a/test/phlex/view/naughty_business.rb
+++ b/test/phlex/view/naughty_business.rb
@@ -53,7 +53,7 @@ def view_template
 		end
 
 		it "escapes the attributes" do
-			expect(output).to be == %(<article id="&quot;&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;bad_script.js&quot;&gt;&lt;/script&gt;"></article>)
+			expect(output).to be == %(<article id="&quot;><script type=&quot;text/javascript&quot; src=&quot;bad_script.js&quot;></script>"></article>)
 		end
 	end