2009-07-05 06:07:14 -04:00
|
|
|
# Haml Changelog
|
|
|
|
|
|
|
|
* Table of contents
|
|
|
|
{:toc}
|
|
|
|
|
2009-09-21 17:43:44 -04:00
|
|
|
## 2.4.0 (Unreleased)
|
2009-07-12 11:20:48 -04:00
|
|
|
|
2010-01-26 19:06:34 -05:00
|
|
|
### `haml_tag` and `haml_concat` Improvements
|
|
|
|
|
|
|
|
#### `haml_tag` with CSS Selectors
|
2009-12-10 07:17:35 -05:00
|
|
|
|
|
|
|
The {Haml::Helpers#haml_tag haml\_tag} helper can now take a string
|
|
|
|
using the same class/id shorthand as in standard Haml code.
|
|
|
|
Manually-specified class and id attributes are merged,
|
|
|
|
again as in standard Haml code.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
haml_tag('#foo') #=> <div id='foo' />
|
|
|
|
haml_tag('.bar) #=> <div class='bar' />
|
|
|
|
haml_tag('span#foo.bar') #=> <span class='bar' id='foo' />
|
|
|
|
haml_tag('span#foo.bar', :class => 'abc') #=> <span class='abc bar' id='foo' />
|
|
|
|
haml_tag('span#foo.bar', :id => 'abc') #=> <span class='bar' id='abc_foo' />
|
|
|
|
|
|
|
|
Cheers, [S. Burkhard](http://github.com/hasclass/).
|
|
|
|
|
2010-01-26 19:06:34 -05:00
|
|
|
#### `haml_tag` with Multiple Lines of Content
|
|
|
|
|
|
|
|
The {Haml::Helpers#haml_tag haml\_tag} helper also does a better job
|
|
|
|
of formatting tags with multiple lines of content.
|
|
|
|
If a tag has multiple levels of content,
|
|
|
|
that content is indented beneath the tag.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
haml_tag(:p, "foo\nbar") #=>
|
|
|
|
# <p>
|
|
|
|
# foo
|
|
|
|
# bar
|
|
|
|
# </p>
|
|
|
|
|
|
|
|
#### `haml_tag` with Multiple Lines of Content
|
|
|
|
|
|
|
|
Similarly, the {Haml::Helpers#haml_concat haml\_concat} helper
|
|
|
|
will properly indent multiple lines of content.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
haml_tag(:p) {haml_concat "foo\nbar"} #=>
|
|
|
|
# <p>
|
|
|
|
# foo
|
|
|
|
# bar
|
|
|
|
# </p>
|
|
|
|
|
|
|
|
#### `haml_tag` and `haml_concat` with `:ugly`
|
|
|
|
|
|
|
|
When the {file:HAML_REFERENCE.md#ugly-option `:ugly` option} is enabled,
|
|
|
|
{Haml::Helpers#haml_tag haml\_tag} and {Haml::Helpers#haml_concat haml\_concat}
|
|
|
|
won't do any indentation of their arguments.
|
|
|
|
|
2010-02-15 17:16:13 -05:00
|
|
|
### Basic Tag Improvements
|
2009-07-12 11:20:48 -04:00
|
|
|
|
2010-02-15 17:16:13 -05:00
|
|
|
* It's now possible to customize the name used for {file:HAML_REFERENCE.md#object_reference_ object reference}
|
|
|
|
for a given object by implementing the `haml_object_ref` method on that object.
|
|
|
|
This method should return a string that will be used in place of the class name of the object
|
|
|
|
in the generated class and id.
|
|
|
|
|
|
|
|
* All attribute values may be non-String types.
|
|
|
|
Their `#to_s` method will be called to convert them to strings.
|
|
|
|
Previously, this only worked for attributes other than `class`.
|
2009-07-12 11:20:48 -04:00
|
|
|
|
2010-02-27 08:52:09 -05:00
|
|
|
### `:class` and `:id` Attributes Accept Ruby Arrays
|
|
|
|
|
|
|
|
In an attribute hash, the `:class` attribute now accepts an Array
|
|
|
|
whose elements will be converted to strings and joined with `" "`.
|
|
|
|
Likewise, the `:id` attribute now accepts an Array
|
|
|
|
whose elements will be converted to strings and joined with `"_"`.
|
|
|
|
The array will first be flattened and any elements that do not test as true
|
|
|
|
will be stripped out. For example:
|
|
|
|
|
|
|
|
.column{:class => [@item.type, @item == @sortcol && [:sort, @sortdir]] }
|
|
|
|
|
|
|
|
could render as any of:
|
|
|
|
|
|
|
|
class="column numeric sort ascending"
|
|
|
|
class="column numeric"
|
|
|
|
class="column sort descending"
|
|
|
|
class="column"
|
|
|
|
|
|
|
|
depending on whether `@item.type` is `"numeric"` or `nil`,
|
|
|
|
whether `@item == @sortcol`,
|
|
|
|
and whether `@sortdir` is `"ascending"` or `"descending"`.
|
|
|
|
|
|
|
|
A single value can still be specified.
|
|
|
|
If that value evaluates to false it is ignored;
|
|
|
|
otherwise it gets converted to a string.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
.item{:class => @item.is_empty? && "empty"}
|
|
|
|
|
|
|
|
could render as either of:
|
|
|
|
|
|
|
|
class="item"
|
|
|
|
class="item empty"
|
|
|
|
|
2010-03-14 18:20:26 -04:00
|
|
|
Thanks to [Ronen Barzel](http://www.ronenbarzel.org/).
|
|
|
|
|
2009-11-14 15:44:40 -05:00
|
|
|
### More Powerful `:autoclose` Option
|
|
|
|
|
|
|
|
The {file:HAML_REFERENCE.md#attributes_option `:attributes`} option
|
|
|
|
can now take regular expressions that specify which tags to make self-closing.
|
|
|
|
|
2009-07-31 00:34:43 -04:00
|
|
|
### `--double-quote-attributes` Option
|
|
|
|
|
|
|
|
The Haml executable now has a `--double-quote-attributes` option (short form: `-q`)
|
|
|
|
that causes attributes to use a double-quote mark rather than single-quote.
|
|
|
|
|
2009-09-18 05:20:16 -04:00
|
|
|
### `haml-spec` Integration
|
|
|
|
|
|
|
|
We've added the cross-implementation tests from the [haml-spec](http://github.com/norman/haml-spec) project
|
|
|
|
to the standard Haml test suite, to be sure we remain compatible with the base functionality
|
|
|
|
of the many and varied [Haml implementations](http://en.wikipedia.org/wiki/Haml#Implementations).
|
|
|
|
|
2009-09-23 18:32:08 -04:00
|
|
|
### Ruby 1.9 Support
|
|
|
|
|
2010-02-14 18:25:36 -05:00
|
|
|
* Haml and `html2haml` now produce more descriptive errors
|
|
|
|
when given a template with invalid byte sequences for that template's encoding,
|
|
|
|
including the line number and the offending character.
|
|
|
|
|
|
|
|
* Haml and `html2haml` now accept Unicode documents with a
|
|
|
|
[byte-order-mark](http://en.wikipedia.org/wiki/Byte_order_mark).
|
2009-09-23 18:32:08 -04:00
|
|
|
|
2009-11-09 22:46:36 -05:00
|
|
|
### `:css` Filter
|
|
|
|
|
|
|
|
Haml now supports a {file:HAML_REFERENCE.md#css-filter `:css` filter}
|
|
|
|
that surrounds the filtered text with `<style>` and CDATA tags.
|
|
|
|
|
2010-02-28 23:30:39 -05:00
|
|
|
### Rails Support
|
|
|
|
|
|
|
|
* When `form_for` is used with `=`, or `form_tag` is used with `=` and a block,
|
|
|
|
they will now raise errors explaining that they should be used with `-`.
|
|
|
|
This is similar to how {Haml::Helpers#haml\_concat} behaves,
|
|
|
|
and will hopefully clear up some difficult bugs for some users.
|
|
|
|
|
2009-10-05 06:12:24 -04:00
|
|
|
### `html2haml` Improvements
|
|
|
|
|
2009-10-23 05:23:00 -04:00
|
|
|
* Ruby blocks within ERB are now supported.
|
|
|
|
The Haml code is properly indented and the `end`s are removed.
|
|
|
|
This includes methods with blocks and all language constructs
|
|
|
|
such as `if`, `begin`, and `case`.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
<% content_for :footer do %>
|
|
|
|
<p>Hi there!</p>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
is now transformed into:
|
|
|
|
|
|
|
|
- content_for :footer do
|
|
|
|
%p Hi there!
|
|
|
|
|
2009-10-23 05:34:54 -04:00
|
|
|
Thanks to [Jack Chen](http://chendo.net) and [Dr. Nic Williams](http://drnicwilliams)
|
|
|
|
for inspiring this and creating the first draft of the code.
|
|
|
|
|
2009-10-05 06:24:35 -04:00
|
|
|
* Inline HTML text nodes are now transformed into inline Haml text.
|
|
|
|
For example, `<p>foo</p>` now becomes `%p foo`, whereas before it became:
|
2009-10-05 06:12:24 -04:00
|
|
|
|
2009-10-05 06:24:35 -04:00
|
|
|
%p
|
|
|
|
foo
|
2009-10-05 06:12:24 -04:00
|
|
|
|
2009-10-05 22:56:40 -04:00
|
|
|
The same is true for inline comments,
|
|
|
|
and inline ERB when running in ERB mode:
|
2009-10-05 06:24:35 -04:00
|
|
|
`<p><%= foo %></p>` will now become `%p= foo`.
|
|
|
|
|
2009-10-05 19:24:38 -04:00
|
|
|
* ERB included within text is now transformed into Ruby interpolation.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Foo <%= bar %> baz!
|
|
|
|
Flip <%= bang %>.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
is now transformed into:
|
|
|
|
|
|
|
|
%p
|
|
|
|
Foo #{bar} baz!
|
|
|
|
Flip #{bang}.
|
|
|
|
|
2009-10-05 20:53:35 -04:00
|
|
|
* `<script>` tags are now transformed into `:javascript` filters,
|
2009-10-05 21:03:35 -04:00
|
|
|
and `<style>` tags into `:css` filters.
|
2009-10-05 20:53:35 -04:00
|
|
|
and indentation is preserved.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function foo() {
|
|
|
|
return 12;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
is now transformed into:
|
|
|
|
|
|
|
|
:javascript
|
|
|
|
function foo() {
|
|
|
|
return 12;
|
|
|
|
}
|
|
|
|
|
2009-10-05 22:44:03 -04:00
|
|
|
* `<pre>` and `<textarea>` tags are now transformed into the `:preserve` filter.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
<pre>Foo
|
|
|
|
bar
|
|
|
|
baz</pre>
|
|
|
|
|
|
|
|
is now transformed into:
|
|
|
|
|
|
|
|
%pre
|
|
|
|
:preserve
|
|
|
|
Foo
|
|
|
|
bar
|
|
|
|
baz
|
|
|
|
|
2009-10-05 23:17:33 -04:00
|
|
|
* Self-closing tags (such as `<br />`) are now transformed into
|
|
|
|
self-closing Haml tags (like `%br/`).
|
|
|
|
|
2009-10-10 20:42:57 -04:00
|
|
|
* IE conditional comments are now properly parsed.
|
|
|
|
|
2009-10-05 06:24:35 -04:00
|
|
|
* Attributes are now output in a more-standard format,
|
|
|
|
without spaces within the curly braces
|
|
|
|
(e.g. `%p{:foo => "bar"}` as opposed to `%p{ :foo => "bar" }`).
|
2009-10-05 06:12:24 -04:00
|
|
|
|
2009-10-20 04:07:14 -04:00
|
|
|
* IDs and classes containing `#` and `.` are now output as string attributes
|
|
|
|
(e.g. `%p{:class => "foo.bar"}`).
|
|
|
|
|
2009-10-05 06:26:42 -04:00
|
|
|
* Attributes are now sorted, to maintain a deterministic order.
|
|
|
|
|
2009-10-23 05:27:02 -04:00
|
|
|
* Multi-line ERB statements are now properly indented,
|
|
|
|
and those without any content are removed.
|
|
|
|
|
2010-01-12 19:10:28 -05:00
|
|
|
### Backwards Incompatibilities: Must Read!
|
|
|
|
|
|
|
|
* The `puts` helper has been removed.
|
|
|
|
Use {Haml::Helpers#haml\_concat} instead.
|
|
|
|
|
2010-03-13 01:17:17 -05:00
|
|
|
## 2.2.21
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21).
|
2010-02-25 23:35:12 -05:00
|
|
|
|
|
|
|
* Fix a few bugs in the git-revision-reporting in {Haml::Version#version}.
|
|
|
|
In particular, it will still work if `git gc` has been called recently,
|
|
|
|
or if various files are missing.
|
|
|
|
|
2010-02-28 19:50:33 -05:00
|
|
|
* Always use `__FILE__` when reading files within the Haml repo in the `Rakefile`.
|
|
|
|
According to [this bug report](http://github.com/carlhuda/bundler/issues/issue/44),
|
|
|
|
this should make Haml work better with Bundler.
|
|
|
|
|
2010-03-06 17:34:22 -05:00
|
|
|
* Make the error message for `- end` a little more intuitive based on user feedback.
|
|
|
|
|
2010-03-13 00:31:32 -05:00
|
|
|
* Compatibility with methods like `form_for`
|
|
|
|
that return strings rather than concatenate to the template in Rails 3.
|
|
|
|
|
|
|
|
* Add a {Haml::Helpers#with_tabs with_tabs} helper,
|
|
|
|
which sets the indentation level for the duration of a block.
|
|
|
|
|
2010-02-15 21:07:53 -05:00
|
|
|
## 2.2.20
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.20).
|
2010-02-08 20:31:31 -05:00
|
|
|
|
|
|
|
* The `form_tag` Rails helper is now properly marked as HTML-safe
|
|
|
|
when using Rails' XSS protection with Rails 2.3.5.
|
|
|
|
|
2010-02-15 20:09:20 -05:00
|
|
|
* Calls to `defined?` shouldn't interfere with Rails' autoloading
|
|
|
|
in very old versions (1.2.x).
|
|
|
|
|
2010-02-15 20:45:26 -05:00
|
|
|
* Fix a bug where calls to ActionView's `render` method
|
|
|
|
with blocks and layouts wouldn't work under the Rails 3.0 beta.
|
|
|
|
|
2010-02-15 20:56:58 -05:00
|
|
|
* Fix a bug where the closing tags of nested calls to \{Haml::Helpers#haml\_concat}
|
|
|
|
were improperly escaped under the Rails 3.0 beta.
|
|
|
|
|
2010-02-07 03:17:25 -05:00
|
|
|
## 2.2.19
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.19).
|
2010-02-07 03:12:22 -05:00
|
|
|
|
|
|
|
* Fix a bug with the integration with Rails' XSS support.
|
|
|
|
In particular, correctly override `safe_concat`.
|
|
|
|
|
2010-02-05 00:44:17 -05:00
|
|
|
## 2.2.18
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.18).
|
2010-01-21 23:08:46 -05:00
|
|
|
|
2010-02-05 00:06:35 -05:00
|
|
|
* Support [the new XSS-protection API](http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/)
|
|
|
|
used in Rails 3.
|
|
|
|
|
2010-01-21 23:08:46 -05:00
|
|
|
* Use `Rails.env` rather than `RAILS_ENV` when running under Rails 3.0.
|
|
|
|
Thanks to [Duncan Grazier](http://duncangrazier.com/).
|
|
|
|
|
2010-01-23 16:00:14 -05:00
|
|
|
* Add a `--unix-newlines` flag to all executables
|
|
|
|
for outputting Unix-style newlines on Windows.
|
|
|
|
|
2010-01-29 15:13:57 -05:00
|
|
|
* Fix a couple bugs with the `:erb` filter:
|
|
|
|
make sure error reporting uses the correct line numbers,
|
|
|
|
and allow multi-line expressions.
|
|
|
|
|
2010-01-30 18:58:50 -05:00
|
|
|
* Fix a parsing bug for HTML-style attributes including `#`.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.17
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.17).
|
2009-12-18 16:29:32 -05:00
|
|
|
|
|
|
|
* Fix compilation of HTML5 doctypes when using `html2haml`.
|
|
|
|
|
2010-01-07 18:40:39 -05:00
|
|
|
* `nil` values for Sass options are now ignored,
|
|
|
|
rather than raising errors.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.16
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.16).
|
2009-12-10 15:29:06 -05:00
|
|
|
|
|
|
|
* Abstract out references to `ActionView::TemplateError`,
|
|
|
|
`ActionView::TemplateHandler`, etc.
|
|
|
|
These have all been renamed to `ActionView::Template::*`
|
|
|
|
in Rails 3.0.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.15
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.15).
|
2009-11-25 23:04:04 -05:00
|
|
|
|
|
|
|
* Allow `if` statements with no content followed by `else` clauses.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
- if foo
|
|
|
|
- else
|
|
|
|
bar
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.14
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.14).
|
2009-11-11 17:30:11 -05:00
|
|
|
|
|
|
|
* Don't print warnings when escaping attributes containing non-ASCII characters
|
|
|
|
in Ruby 1.9.
|
|
|
|
|
2009-11-11 17:46:38 -05:00
|
|
|
* Don't crash when parsing an XHTML Strict doctype in `html2haml`.
|
|
|
|
|
2009-11-20 06:07:21 -05:00
|
|
|
* Support the HTML5 doctype in an XHTML document
|
|
|
|
by using `!!! 5` as the doctype declaration.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.13
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.13).
|
[Haml] Add support for a workaround for fake ASCII input strings.
Closes gh-3
This is a complicated issue, but I'll do my best to explain it here.
By default, Haml encodes its templates as Encoding.default_internal,
which is usually UTF-8. This means that strings printed to the
template should be either UTF-8 or UTF-8-compatible ASCII. So far, all
well and good.
Now, it's possible to have strings that are marked as ASCII-8bit, but
which aren't UTF-8 compatible. This includes valid UTF-8 strings that
are forced into an ASCII-8bit encoding. If one of these strings is
concatenated to a UTF-8 string, Ruby says "I don't know what to do
with these non-ASCII characters!" and throws an encoding error. I call
this sort of string "fake ASCII."
This is what was happening in the referenced GitHub issue (or at least
in the sample app Adam Salter created at
http://github.com/adamsalter/test-project/tree/haml_utf8). The
template was UTF-8 encoded, and it was being passed a fake ASCII
string, marked as ASCII-8bit but with UTF-8 byte sequences in it, and
it was choking.
The issue now becomes: where is this fake ASCII string coming from?
From the database. The database drivers used by Rails aren't Ruby 1.9
compatible. Despite storing UTF-8 strings in the database, the drivers
return fake ASCII strings.
The best solution to this is clearly to fix the database drivers, but
that will probably take some time. One stop-gap would be to call
`force_encoding("utf-8")` on all the database values somewhere, which
is still a little annoying. Finally, the solution provided in this
commit is to set `:encoding => "ascii-8bit"` for Haml. This makes the
Haml template itself fake ASCII, which is wrong but will help prevent
encoding errors.
2009-11-08 18:59:52 -05:00
|
|
|
|
|
|
|
* Allow users to specify {file:HAML_REFERENCE.md#encoding_option `:encoding => "ascii-8bit"`}
|
|
|
|
even for templates that include non-ASCII byte sequences.
|
|
|
|
This makes Haml templates not crash when given non-ASCII input
|
|
|
|
that's marked as having an ASCII encoding.
|
|
|
|
|
2009-11-08 19:40:37 -05:00
|
|
|
* Fixed an incompatibility with Hpricot 0.8.2, which is used for `html2haml`.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.12
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.12).
|
2009-11-06 01:57:24 -05:00
|
|
|
|
2009-11-23 14:12:35 -05:00
|
|
|
There were no changes made to Haml between versions 2.2.11 and 2.2.12.
|
2009-11-06 01:57:24 -05:00
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.11
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.11).
|
2009-10-30 00:07:53 -04:00
|
|
|
|
|
|
|
* 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-11-05 21:19:18 -05:00
|
|
|
* Don't crash if the plugin skeleton is installed and `rake gems:install` is run.
|
|
|
|
|
2009-11-04 22:01:39 -05:00
|
|
|
* Don't use `RAILS_ROOT` directly.
|
|
|
|
This no longer exists in Rails 3.0.
|
|
|
|
Instead abstract this out as `Haml::Util.rails_root`.
|
2009-11-05 23:14:28 -05:00
|
|
|
This changes makes Haml fully compatible with edge Rails as of this writing.
|
2009-11-04 22:01:39 -05:00
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.10
|
|
|
|
|
|
|
|
[Tagged on GitHub](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.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.9
|
|
|
|
|
|
|
|
[Tagged on GitHub](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.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.8
|
|
|
|
|
|
|
|
[Tagged on GitHub](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.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.7
|
|
|
|
|
|
|
|
[Tagged on GitHub](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.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.6
|
|
|
|
|
|
|
|
[Tagged on GitHub](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
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.5
|
|
|
|
|
|
|
|
[Tagged on GitHub](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
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.4
|
|
|
|
|
|
|
|
[Tagged on GitHub](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
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.3
|
|
|
|
|
|
|
|
[Tagged on GitHub](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).
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.2
|
|
|
|
|
|
|
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.2).
|
2009-07-20 04:45:22 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.1
|
|
|
|
|
|
|
|
[Tagged on GitHub](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.
|
|
|
|
|
2010-02-05 00:08:31 -05:00
|
|
|
## 2.2.0
|
|
|
|
|
|
|
|
[Tagged on GitHub](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.
|
2010-01-12 19:10:28 -05:00
|
|
|
Use `haml_concat` instead and spare me the embarrassment.
|
2009-07-05 06:07:14 -04:00
|
|
|
|
|
|
|
#### `= 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.
|