2009-07-05 06:07:14 -04:00
|
|
|
# Haml Changelog
|
|
|
|
|
|
|
|
* Table of contents
|
|
|
|
{:toc}
|
|
|
|
|
2009-10-30 00:07:53 -04:00
|
|
|
## 2.2.11 (Unreleased)
|
|
|
|
|
|
|
|
* Fixed a bug with XSS protection where HTML escaping would raise an error
|
|
|
|
if passed a non-string value.
|
|
|
|
Note that this doesn't affect any HTML escaping when XSS protection is disabled.
|
|
|
|
|
2009-11-02 18:12:42 -05:00
|
|
|
* Fixed a bug in outer-whitespace nuking where whitespace-only Ruby strings
|
|
|
|
blocked whitespace nuking beyond them.
|
|
|
|
|
2009-11-03 23:08:43 -05:00
|
|
|
* Use `ensure` to protect the resetting of the Haml output buffer
|
|
|
|
against exceptions that are raised within the compiled Haml code.
|
|
|
|
|
2009-11-03 23:18:13 -05:00
|
|
|
* Fix an error line-numbering bug that appeared if an error was thrown
|
|
|
|
within loud script (`=`).
|
|
|
|
This is not the best solution, as it disables a few optimizations,
|
|
|
|
but it shouldn't have too much effect and the optimizations
|
|
|
|
will hopefully be re-enabled in version 2.4.
|
|
|
|
|
2009-10-31 06:09:47 -04:00
|
|
|
* Allow multiple ids to be used on the same element.
|
|
|
|
They will be concatenated together with an underscore.
|
|
|
|
For example, `%p#foo#bar` will become `<p id="foo_bar">`.
|
|
|
|
This is consistent with the behavior of multiple ids
|
|
|
|
when one is specified as a standard attribute.
|
|
|
|
|
2009-10-29 17:44:45 -04:00
|
|
|
## [2.2.10](http://github.com/nex3/haml/commit/2.2.10)
|
2009-10-25 17:36:09 -04:00
|
|
|
|
|
|
|
* Fixed a bug where elements with dynamic attributes and no content
|
|
|
|
would have too much whitespace between the opening and closing tag.
|
|
|
|
|
2009-10-29 16:27:24 -04:00
|
|
|
* Changed `rails/init.rb` away from loading `init.rb` and instead
|
|
|
|
have it basically copy the content.
|
|
|
|
This allows us to transfer the proper binding to `Haml.init_rails`.
|
|
|
|
|
|
|
|
* Make sure Haml only tries to enable XSS protection integration
|
|
|
|
once all other plugins are loaded.
|
|
|
|
This allows it to work properly when Haml is a gem
|
|
|
|
and the `rails_xss` plugin is being used.
|
|
|
|
|
2009-10-29 17:14:30 -04:00
|
|
|
* Mark the return value of Haml templates as HTML safe.
|
|
|
|
This makes Haml partials work with Rails' XSS protection.
|
|
|
|
|
2009-10-17 18:27:04 -04:00
|
|
|
## [2.2.9](http://github.com/nex3/haml/commit/2.2.9)
|
2009-10-14 20:57:12 -04:00
|
|
|
|
|
|
|
* Fixed a bug where Haml's text was concatenated to the wrong buffer
|
|
|
|
under certain circumstances.
|
|
|
|
This was mostly an issue under Rails when using methods like `capture`.
|
|
|
|
|
2009-10-16 21:31:04 -04:00
|
|
|
* Fixed a bug where template text was escaped when there was interpolation in a line
|
|
|
|
and the `:escape_html` option was enabled. For example:
|
|
|
|
|
|
|
|
Foo < Bar #{"<"} Baz
|
|
|
|
|
|
|
|
with `:escape_html` used to render as
|
|
|
|
|
|
|
|
Foo &lt; Bar < Baz
|
|
|
|
|
|
|
|
but now renders as
|
|
|
|
|
|
|
|
Foo < Bar < Baz
|
|
|
|
|
2009-10-17 18:13:35 -04:00
|
|
|
### Rails XSS Protection
|
|
|
|
|
|
|
|
Haml 2.2.9 supports the XSS protection in Rails versions 2.3.5+.
|
|
|
|
There are several components to this:
|
|
|
|
|
|
|
|
* If XSS protection is enabled, Haml's {file:HAML_REFERENCE.md#escape_html-option `:escape_html`}
|
|
|
|
option is set to `true` by default.
|
|
|
|
|
|
|
|
* Strings declared as HTML safe won't be escaped by Haml,
|
|
|
|
including the {file:Haml/Helpers.html#html_escape-instance_method `#html_escape`} helper
|
|
|
|
and `&=` if `:escape_html` has been disabled.
|
|
|
|
|
|
|
|
* Haml helpers that generate HTML are marked as HTML safe,
|
|
|
|
and will escape their input if it's not HTML safe.
|
|
|
|
|
2009-10-11 18:51:16 -04:00
|
|
|
## [2.2.8](http://github.com/nex3/haml/commit/2.2.8)
|
2009-10-11 18:43:13 -04:00
|
|
|
|
|
|
|
* Fixed a potential XSS issue with HTML escaping and wacky Unicode nonsense.
|
|
|
|
This is the same as [the issue fixed in Rails](http://groups.google.com/group/rubyonrails-security/browse_thread/thread/48ab3f4a2c16190f) a bit ago.
|
|
|
|
|
2009-10-08 20:09:42 -04:00
|
|
|
## [2.2.7](http://github.com/nex3/haml/commit/2.2.7)
|
2009-10-05 06:39:40 -04:00
|
|
|
|
|
|
|
* Fixed an `html2haml` issue where ERB attribute values
|
|
|
|
weren't HTML-unescaped before being transformed into Haml.
|
|
|
|
|
2009-10-05 06:42:15 -04:00
|
|
|
* Fixed an `html2haml` issue where `#{}` wasn't escaped
|
|
|
|
before being transformed into Haml.
|
|
|
|
|
2009-10-05 22:25:13 -04:00
|
|
|
* Add `<code>` to the list of tags that's
|
|
|
|
{file:HAML_REFERENCE.md#preserve-option automatically whitespace-preserved}.
|
|
|
|
|
2009-10-08 07:00:27 -04:00
|
|
|
* Fixed a bug with `end` being followed by code in silent scripts -
|
|
|
|
it no longer throws an error when it's nested beneath tags.
|
|
|
|
|
2009-10-08 07:14:16 -04:00
|
|
|
* Fixed a bug with inner whitespace-nuking and conditionals.
|
|
|
|
The `else` et al. clauses of conditionals are now properly
|
|
|
|
whitespace-nuked.
|
|
|
|
|
2009-09-28 01:53:15 -04:00
|
|
|
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
|
2009-09-21 15:34:39 -04:00
|
|
|
|
|
|
|
* Made the error message when unable to load a dependency for html2haml
|
|
|
|
respect the `--trace` option.
|
|
|
|
|
2009-09-23 05:38:52 -04:00
|
|
|
* Don't crash when the `__FILE__` constant of a Ruby file is a relative path,
|
|
|
|
as apparently happens sometimes in TextMate
|
2009-10-04 20:49:38 -04:00
|
|
|
(thanks to [Karl Varga](http://github.com/kjvarga)).
|
2009-10-04 20:36:59 -04:00
|
|
|
|
2009-09-23 18:58:25 -04:00
|
|
|
* Add "Sass" to the `--version` string for the executables.
|
2009-09-23 05:38:52 -04:00
|
|
|
|
2009-09-27 20:37:22 -04:00
|
|
|
* Raise an exception when commas are omitted in static attributes
|
|
|
|
(e.g. `%p{:foo => "bar" :baz => "bang"}`).
|
2009-09-23 05:38:52 -04:00
|
|
|
|
2009-09-18 05:25:17 -04:00
|
|
|
## [2.2.5](http://github.com/nex3/haml/commit/2.2.5)
|
2009-09-15 16:17:35 -04:00
|
|
|
|
|
|
|
* Got rid of trailing whitespace produced when opening a conditional comment
|
|
|
|
(thanks to [Norman Clarke](http://blog.njclarke.com/)).
|
2009-09-18 04:14:53 -04:00
|
|
|
|
|
|
|
* Fixed CSS id concatenation when a numeric id is given as an attribute.
|
|
|
|
(thanks to [Norman Clarke](http://blog.njclarke.com/)).
|
2009-09-18 04:36:11 -04:00
|
|
|
|
|
|
|
* Fixed a couple bugs with using "-end" in strings.
|
2009-09-15 16:17:35 -04:00
|
|
|
|
2009-09-14 06:40:58 -04:00
|
|
|
## [2.2.4](http://github.com/nex3/haml/commit/2.2.4)
|
2009-08-28 02:01:56 -04:00
|
|
|
|
2009-09-02 01:14:55 -04:00
|
|
|
* Allow `end` to be used for silent script when it's followed by code.
|
|
|
|
For example:
|
2009-08-28 02:01:56 -04:00
|
|
|
|
2009-09-02 01:14:55 -04:00
|
|
|
- form_for do
|
|
|
|
...
|
|
|
|
- end if @show_form
|
2009-08-28 02:01:56 -04:00
|
|
|
|
2009-09-02 01:14:55 -04:00
|
|
|
This isn't very good style, but we're supporting it for consistency's sake.
|
|
|
|
|
|
|
|
* Don't add `require 'rubygems'` to the top of init.rb when installed
|
|
|
|
via `haml --rails`. This isn't necessary, and actually gets
|
|
|
|
clobbered as soon as haml/template is loaded.
|
2009-08-28 02:01:56 -04:00
|
|
|
|
2009-08-25 03:24:55 -04:00
|
|
|
## [2.2.3](http://github.com/nex3/haml/commit/2.2.3)
|
2009-08-04 03:46:53 -04:00
|
|
|
|
|
|
|
Haml 2.2.3 adds support for the JRuby bundling tools
|
|
|
|
for Google AppEngine, thanks to [Jan Ulbrich](http://github.com/ulbrich).
|
|
|
|
|
2009-07-20 04:45:22 -04:00
|
|
|
## [2.2.2](http://github.com/nex3/haml/commit/2.2.2)
|
|
|
|
|
|
|
|
Haml 2.2.2 is a minor bugfix release, with several notable changes.
|
|
|
|
First, {file:Haml/Helpers.html#haml_concat-instance_method `haml_concat`}
|
|
|
|
will now raise an error when used with `=`.
|
|
|
|
This has always been incorrect behavior,
|
|
|
|
and in fact has never actually worked.
|
|
|
|
The only difference is that now it will fail loudly.
|
|
|
|
Second, Ruby 1.9 is now more fully supported,
|
2009-09-14 06:32:44 -04:00
|
|
|
especially with the {file:HAML_REFERENCE.md#htmlstyle_attributes_ new attribute syntax}.
|
|
|
|
Third, filters are no longer escaped when the {file:HAML_REFERENCE.md#escape_html-option `:escape_html` option}
|
2009-07-20 04:45:22 -04:00
|
|
|
is enabled and `#{}` interpolation is used.
|
|
|
|
|
2009-07-16 01:35:24 -04:00
|
|
|
## [2.2.1](http://github.com/nex3/haml/commit/2.2.1)
|
2009-07-12 11:00:30 -04:00
|
|
|
|
|
|
|
Haml 2.2.1 is a minor bug-fix release.
|
|
|
|
|
2009-07-16 01:35:24 -04:00
|
|
|
## [2.2.0](http://github.com/nex3/haml/commit/2.2.0)
|
2009-07-05 06:07:14 -04:00
|
|
|
|
|
|
|
Haml 2.2 adds several new features to the language,
|
|
|
|
fixes several bugs, and dramatically improves performance
|
|
|
|
(particularly when running with {file:HAML_REFERENCE.md#ugly-option `:ugly`} enabled).
|
|
|
|
|
|
|
|
### Syntax Changes
|
|
|
|
|
|
|
|
#### HTML-Style Attribute Syntax
|
|
|
|
|
|
|
|
Haml 2.2 introduces a new syntax for attributes
|
|
|
|
based on the HTML syntax.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
%a(href="http://haml-lang.com" title="Haml's so cool!")
|
|
|
|
%img(src="/images/haml.png" alt="Haml")
|
|
|
|
|
|
|
|
There are two main reasons for this.
|
|
|
|
First, the hash-style syntax is very Ruby-specific.
|
|
|
|
There are now [Haml implementations](http://en.wikipedia.org/wiki/Haml#Implementations)
|
|
|
|
in many languages, each of which has its own syntax for hashes
|
|
|
|
(or dicts or associative arrays or whatever they're called).
|
|
|
|
The HTML syntax will be adopted by all of them,
|
|
|
|
so you can feel comfortable using Haml in whichever language you need.
|
|
|
|
|
|
|
|
Second, the hash-style syntax is quite verbose.
|
|
|
|
`%img{:src => "/images/haml.png", :alt => "Haml"}`
|
|
|
|
is eight characters longer than `%img(src="/images/haml.png" alt="Haml")`.
|
|
|
|
Haml's supposed to be about writing templates quickly and easily;
|
|
|
|
HTML-style attributes should help out a lot with that.
|
|
|
|
|
|
|
|
Ruby variables can be used as attribute values by omitting quotes.
|
|
|
|
Local variables or instance variables can be used.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
%a(title=@title href=href) Stuff
|
|
|
|
|
|
|
|
This is the same as:
|
|
|
|
|
|
|
|
%a{:title => @title, :href => href} Stuff
|
|
|
|
|
|
|
|
Because there are no commas separating attributes,
|
|
|
|
more complicated expressions aren't allowed.
|
|
|
|
You can use `#{}` interpolation to insert complicated expressions
|
|
|
|
in a HTML-style attribute, though:
|
|
|
|
|
|
|
|
%span(class="widget_#{@widget.number}")
|
|
|
|
|
|
|
|
#### Multiline Attributes
|
|
|
|
|
|
|
|
In general, Haml tries to keep individual elements on a single line.
|
|
|
|
There is a [multiline syntax](#multiline) for overflowing onto further lines,
|
|
|
|
but it's intentionally awkward to use to encourage shorter lines.
|
|
|
|
|
|
|
|
However, there is one case where overflow is reasonable: attributes.
|
|
|
|
Often a tag will simply have a lot of attributes, and in this case
|
|
|
|
it makes sense to allow overflow.
|
|
|
|
You can now stretch an attribute hash across multiple lines:
|
|
|
|
|
|
|
|
%script{:type => "text/javascript",
|
|
|
|
:src => "javascripts/script_#{2 + 7}"}
|
|
|
|
|
|
|
|
This also works for HTML-style attributes:
|
|
|
|
|
|
|
|
%script(type="text/javascript"
|
|
|
|
src="javascripts/script_#{2 + 7}")
|
|
|
|
|
|
|
|
Note that for hash-style attributes, the newlines must come after commas.
|
|
|
|
|
|
|
|
#### Universal interpolation
|
|
|
|
|
|
|
|
In Haml 2.0, you could use `==` to interpolate Ruby code
|
|
|
|
within a line of text using `#{}`.
|
|
|
|
In Haml 2.2, the `==` is unnecessary;
|
|
|
|
`#{}` can be used in any text.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
%p This is a really cool #{h what_is_this}!
|
|
|
|
But is it a #{h what_isnt_this}?
|
|
|
|
|
|
|
|
In addition, to {file:HAML_REFERENCE.md#escaping_html escape} or {file:HAML_REFERENCE.md#unescaping_html unescape}
|
|
|
|
the interpolated code, you can just add `&` or `!`, respectively,
|
|
|
|
to the beginning of the line:
|
|
|
|
|
|
|
|
%p& This is a really cool #{what_is_this}!
|
|
|
|
& But is it a #{what_isnt_this}?
|
|
|
|
|
|
|
|
#### Flexible indentation
|
|
|
|
|
|
|
|
Haml has traditionally required its users to use two spaces of indentation.
|
|
|
|
This is the universal Ruby style, and still highly recommended.
|
|
|
|
However, Haml now allows any number of spaces or even tabs for indentation,
|
|
|
|
provided:
|
|
|
|
|
|
|
|
* Tabs and spaces are not mixed
|
|
|
|
* The indentation is consistent within a given document
|
|
|
|
|
|
|
|
### New Options
|
|
|
|
|
|
|
|
#### `:ugly`
|
|
|
|
|
|
|
|
The `:ugly` option is not technically new;
|
|
|
|
it was introduced in Haml 2.0 to make rendering deeply nested templates less painful.
|
|
|
|
However, it's been greatly empowered in Haml 2.2.
|
|
|
|
It now does all sorts of performance optimizations
|
|
|
|
that couldn't be done before,
|
|
|
|
and its use increases Haml's performance dramatically.
|
|
|
|
It's enabled by default in production in Rails,
|
|
|
|
and it's highly recommended for production environments
|
|
|
|
in other frameworks.
|
|
|
|
|
|
|
|
#### `:encoding` {#encoding-option}
|
|
|
|
|
|
|
|
This option specifies the encoding of the Haml template
|
|
|
|
when running under Ruby 1.9. It defaults to `Encoding.default_internal` or `"utf-8"`.
|
|
|
|
This is useful for making sure that you don't get weird
|
|
|
|
encoding errors when dealing with non-ASCII input data.
|
|
|
|
|
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
#### `Haml::Helpers#puts`
|
|
|
|
|
|
|
|
This helper is being deprecated for the obvious reason
|
|
|
|
that it conflicts with the `Kernel#puts` method.
|
|
|
|
I'm ashamed I ever chose this name.
|
|
|
|
Use `haml_tag` instead and spare me the embarrassment.
|
|
|
|
|
|
|
|
#### `= haml_tag`
|
|
|
|
|
|
|
|
A lot of people accidentally use "`= haml_tag`".
|
|
|
|
This has always been wrong; `haml_tag` outputs directly to the template,
|
|
|
|
and so should be used as "`- haml_tag`".
|
|
|
|
Now it raises an error when you use `=`.
|
|
|
|
|
|
|
|
### Compatibility
|
|
|
|
|
|
|
|
#### Rails
|
|
|
|
|
|
|
|
Haml 2.2 is fully compatible with Rails,
|
|
|
|
from 2.0.6 to the latest revision of edge, 783db25.
|
|
|
|
|
|
|
|
#### Ruby 1.9
|
|
|
|
|
|
|
|
Haml 2.2 is also fully compatible with Ruby 1.9.
|
|
|
|
It supports Ruby 1.9-style attribute hashes,
|
|
|
|
and handles encoding-related issues
|
|
|
|
(see [the `:encoding` option](#encoding-option)).
|
|
|
|
|
|
|
|
### Filters
|
|
|
|
|
|
|
|
#### `:markdown`
|
|
|
|
|
|
|
|
There are numerous improvements to the Markdown filter.
|
|
|
|
No longer will Haml attempt to use RedCloth's inferior Markdown implementation.
|
|
|
|
Instead, it will look for all major Markdown implementations:
|
|
|
|
[RDiscount](http://github.com/rtomayko/rdiscount),
|
|
|
|
[RPeg-Markdown](http://github.com/rtomayko/rpeg-markdown),
|
|
|
|
[Maruku](http://maruku.rubyforge.org),
|
|
|
|
and [BlueCloth](www.deveiate.org/projects/BlueCloth).
|
|
|
|
|
|
|
|
#### `:cdata`
|
|
|
|
|
|
|
|
There is now a `:cdata` filter for wrapping text in CDATA tags.
|
|
|
|
|
|
|
|
#### `:sass`
|
|
|
|
|
|
|
|
The `:sass` filter now uses options set in {Sass::Plugin},
|
|
|
|
if they're available.
|
|
|
|
|
|
|
|
### Executables
|
|
|
|
|
|
|
|
#### `haml`
|
|
|
|
|
|
|
|
The `haml` executable now takes `-r` and `-I` flags
|
|
|
|
that act just like the same flags for the `ruby` executable.
|
|
|
|
This allows users to load helper files when using Haml
|
|
|
|
from the command line.
|
|
|
|
|
|
|
|
It also takes a `--debug` flag that causes it to spit out
|
|
|
|
the Ruby code that Haml generates from the template.
|
|
|
|
This is more for my benefit than anything,
|
|
|
|
but you may find it interesting.
|
|
|
|
|
|
|
|
#### `html2haml`
|
|
|
|
|
|
|
|
The `html2haml` executable has undergone significant improvements.
|
|
|
|
Many of these are bugfixes, but there are also a few features.
|
|
|
|
For one, it now understands CDATA tags and autodetects ERB files.
|
|
|
|
In addition, a line containing just "`- end`" is now a Haml error;
|
|
|
|
since it's not possible for `html2haml` to properly parse all Ruby blocks,
|
|
|
|
this acts as a signal for the author that there are blocks
|
|
|
|
to be dealt with.
|
|
|
|
|
|
|
|
### Miscellaneous
|
|
|
|
|
|
|
|
#### XHTML Mobile DTD
|
|
|
|
|
|
|
|
Haml 2.2 supports a DTD for XHTML Mobile: `!!! Mobile`.
|
|
|
|
|
|
|
|
#### YARD
|
|
|
|
|
|
|
|
All the documentation for Haml 2.2, including this changelog,
|
|
|
|
has been moved to [YARD](http://yard.soen.ca).
|
|
|
|
YARD is an excellent documentation system,
|
|
|
|
and allows us to write our documentation in [Maruku](http://maruku.rubyforge.org),
|
|
|
|
which is also excellent.
|