Skip to content

v0.11.0

Latest
Compare
Choose a tag to compare
@stephannv stephannv released this 14 Oct 17:01
· 8 commits to main since this release
3ae768b

What's Changed

Add escape_once helper

It escapes HTML without affecting existing escaped entities

class ExamplePage
  include Blueprint::HTML

  def blueprint
    plain escape_once("1 < 2 &amp; 3")

    span escape_once("&lt;&lt; Accept & Checkout")

    span { escape_once("<script>alert('content')</script>") }
  end
end

puts ExamplePage.new.to_s

Output:

1 &lt; 2 &amp; 3

<span>&lt;&lt; Accept &amp; Checkout</span>

<span>&lt;script&gt;alert(&#39;content&#39;)&lt;/script&gt;</span>

Change attribute value escaper

Before attribute values were escaped using HTML.escape, now the escape is done using .gsub('"', "&quot;").

class ExamplePage
  include Blueprint::HTML

  def blueprint
    input(value: %(>'test'<">))
    # Before <input value="&gt;&#39;test&#39;&lt;&quot;&gt;">
    # After <input value=">'test'<&quot;>">
  end
end

Full Changelog: v0.10.0...v0.11.0