Haml v5.0.0 Release Notes

Release Date: 2017-04-27 // almost 7 years ago
  • ๐Ÿš€ Released on April 26, 2017 (diff).

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ’Ž Haml now requires Ruby 2.0.0 or above.
    • ๐Ÿš… Rails 3 is no longer supported, matching the official Maintenance Policy for Ruby on Rails. Use Haml 4 if you want to use Rails 3. (Tee Parham)
    • โœ‚ Remove :ugly option (#894)
    • The haml command's debug option (-d) no longer executes the Haml code, but rather checks the generated Ruby syntax for errors.
    • โฌ‡๏ธ Drop parser/compiler accessor from Haml::Engine. Modify Haml::Engine#initialize options or Haml::Template.options instead. (Takashi Kokubun)
    • Drop dynamic quotes support and always escape ' for escape_html/escape_attrs instead. Also, escaped results are slightly changed and always unified to the same characters. (Takashi Kokubun)
    • Don't preserve newlines in attributes. (Takashi Kokubun)
    • HTML escape interpolated code in filters. #770 (Matt Wildig)

      :javascript
        #{JSON.generate(foo: "bar")}
      Haml 4 output: {"foo":"bar"}
      Haml 5 output: {"foo":"bar"}
      

    โž• Added

    • โž• Add a tracing option. When enabled, Haml will output a data-trace attribute on each tag showing the path to the source Haml file from which it was generated. Thanks Alex Babkin.
    • ๐Ÿท Add haml_tag_if to render a block, conditionally wrapped in another element (Matt Wildig)
    • ๐Ÿ‘Œ Support Rails 5.1 Erubi template handler.
    • ๐Ÿ‘Œ Support Sprockets 3. Thanks Sam Davies and Jeremy Venezia.
    • ๐ŸŽ General performance and memory usage improvements. (Akira Matsuda)
    • Analyze attribute values by Ripper and render static attributes beforehand. (Takashi Kokubun)
    • โšก๏ธ Optimize attribute rendering about 3x faster. (Takashi Kokubun)
    • โž• Add temple gem as dependency and create Haml::TempleEngine class. Some methods in Haml::Compiler are migrated to Haml::TempleEngine. (Takashi Kokubun)

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix for attribute merging. When an attribute method (or literal nested hash) was used in an old style attribute hash and there is also a (non-static) new style hash there is an error. The fix can result in different behavior in some circumstances. See the commit message for detailed info. (Matt Wildig)
    • ๐Ÿ‘‰ Make escape_once respect hexadecimal references. (Matt Wildig)
    • ๐Ÿ”€ Don't treat the 'data' attribute specially when merging attribute hashes. (Matt Wildig and Norman Clarke)
    • ๐Ÿ›  Fix #@foo and #$foo style interpolation that was not working in html_safe mode. (Akira Matsuda)
    • ๐Ÿ‘ Allow @ as tag's class name. Thanks Joe Bartlett.
    • Raise Haml::InvalidAttributeNameError when attribute name includes invalid characters. (Takashi Kokubun)
    • Don't ignore unexpected exceptions on initializing ActionView::OutputBuffer. (Takashi Kokubun)