mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Merge commit 'origin/stable' into stable
Conflicts: doc-src/SASS_CHANGELOG.md
This commit is contained in:
commit
24cbbfd5d8
6 changed files with 16 additions and 28 deletions
|
@ -21,11 +21,7 @@
|
|||
but it shouldn't have too much effect and the optimizations
|
||||
will hopefully be re-enabled in version 2.4.
|
||||
|
||||
* 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.
|
||||
* Don't crash if the plugin skeleton is installed and `rake gems:install` is run.
|
||||
|
||||
### Edge Rails Compatibility
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
* Fixed `css2sass`'s generation of pseudo-classes so that they're backslash-escaped.
|
||||
|
||||
* Don't crash if the Haml plugin skeleton is installed and `rake gems:install` is run.
|
||||
|
||||
### Edge Rails Compatibility
|
||||
|
||||
* Don't use `RAILS_ROOT` directly.
|
||||
|
|
14
init.rb
14
init.rb
|
@ -1,8 +1,16 @@
|
|||
begin
|
||||
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
|
||||
rescue LoadError
|
||||
require 'haml' # From gem
|
||||
begin
|
||||
require 'haml' # From gem
|
||||
rescue LoadError => e
|
||||
# gems:install may be run to install Haml with the skeleton plugin
|
||||
# but not the gem itself installed.
|
||||
# Don't die if this is the case.
|
||||
raise e unless defined?(Rake) && Rake.application.top_level_tasks.include?('gems:install')
|
||||
end
|
||||
end
|
||||
|
||||
# Load Haml and Sass
|
||||
Haml.init_rails(binding)
|
||||
# Load Haml and Sass.
|
||||
# Haml may be undefined if we're running gems:install.
|
||||
Haml.init_rails(binding) if defined?(Haml)
|
||||
|
|
|
@ -479,13 +479,7 @@ END
|
|||
attributes['class'] = ""
|
||||
end
|
||||
attributes['class'] += property
|
||||
when '#'
|
||||
if attributes['id']
|
||||
attributes['id'] += "_"
|
||||
else
|
||||
attributes['id'] = ""
|
||||
end
|
||||
attributes['id'] += property
|
||||
when '#'; attributes['id'] = property
|
||||
end
|
||||
end
|
||||
attributes
|
||||
|
|
|
@ -278,18 +278,6 @@ RESULT
|
|||
SOURCE
|
||||
end
|
||||
|
||||
def test_multiple_ids
|
||||
assert_equal("<p id='bc_ab'></p>\n", render("%p#bc#ab"))
|
||||
assert_equal("<p id='ab_bc'></p>\n", render("%p#ab#bc"))
|
||||
assert_equal("<p id='ab'></p>\n", render("%p(id='bc' id='ab')"))
|
||||
assert_equal("<p id='bc'></p>\n", render("%p(id='ab' id='bc')"))
|
||||
assert_equal("<p id='bc_ab'></p>\n", render("%p#bc(id='ab')"))
|
||||
assert_equal("<p id='ab_bc'></p>\n", render("%p#ab(id='bc')"))
|
||||
assert_equal("<p id='bc_ab'></p>\n", render("%p#bc{:id => 'ab'}"))
|
||||
assert_equal("<p id='ab_bc'></p>\n", render("%p#ab{:id => 'bc'}"))
|
||||
assert_equal("<p id='ab_bc_cd'></p>\n", render("%p#ab{:id => 'bc'}(id='cd')"))
|
||||
end
|
||||
|
||||
# Regression tests
|
||||
|
||||
def test_whitespace_nuke_with_both_newlines
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<foo2u>11</foo2u>
|
||||
</div>
|
||||
<div class='classes'>
|
||||
<p class='foo bar' id='baz_boom'></p>
|
||||
<p class='foo bar' id='boom'></p>
|
||||
<div class='fooBar'>a</div>
|
||||
<div class='foo-bar'>b</div>
|
||||
<div class='foo_bar'>c</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue