Skip to content

Commit

Permalink
Merge branch '315' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
norman committed Apr 30, 2012
2 parents d414205 + 7c864da commit ad8bd7b
Show file tree
Hide file tree
Showing 11 changed files with 235 additions and 66 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
gemfile:
- test/gemfiles/Gemfile.rails-2.0.x
- test/gemfiles/Gemfile.rails-2.1.x
Expand All @@ -9,11 +9,12 @@ gemfile:
- test/gemfiles/Gemfile.rails-xss-2.3.x
- test/gemfiles/Gemfile.rails-3.0.x
- test/gemfiles/Gemfile.rails-3.1.x
- test/gemfiles/Gemfile.rails-3.2.x
matrix:
exclude:
- { rvm: 1.9.2, gemfile: test/gemfiles/Gemfile.rails-2.0.x }
- { rvm: 1.9.2, gemfile: test/gemfiles/Gemfile.rails-2.1.x }
- { rvm: 1.9.2, gemfile: test/gemfiles/Gemfile.rails-2.2.x }
- { rvm: 1.9.3, gemfile: test/gemfiles/Gemfile.rails-2.0.x }
- { rvm: 1.9.3, gemfile: test/gemfiles/Gemfile.rails-2.1.x }
- { rvm: 1.9.3, gemfile: test/gemfiles/Gemfile.rails-2.2.x }
branches:
only:
- master
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.1.5.beta.1
7 changes: 5 additions & 2 deletions doc-src/HAML_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Respect Rails' `html_safe` flag when escaping attribute values
(thanks to [Gerad Suyderhoud](https://github.com/gerad)).

* Fix for Rails 3.2.3 textarea helpers
(thanks to [James Coleman](https://github.com/jcoleman) and others).

## 3.1.4

* Fix the use of `FormBuilder#block` with a label in Haml.
Expand Down Expand Up @@ -403,7 +406,7 @@ won't do any indentation of their arguments.
* 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`.

### `:class` and `:id` Attributes Accept Ruby Arrays

In an attribute hash, the `:class` attribute now accepts an Array
Expand Down Expand Up @@ -896,7 +899,7 @@ There are several components to this:

* Fixed CSS id concatenation when a numeric id is given as an attribute.
(thanks to [Norman Clarke](http://blog.njclarke.com/)).

* Fixed a couple bugs with using "-end" in strings.

## 2.2.4
Expand Down
4 changes: 2 additions & 2 deletions haml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ HAML_GEMSPEC = Gem::Specification.new do |spec|
spec.name = 'haml'
spec.summary = "An elegant, structured XHTML/XML templating engine."
spec.version = File.read(File.dirname(__FILE__) + '/VERSION').strip
spec.authors = ['Nathan Weizenbaum', 'Hampton Catlin']
spec.email = 'haml@googlegroups.com'
spec.authors = ['Nathan Weizenbaum', 'Hampton Catlin', 'Norman Clarke']
spec.email = ['haml@googlegroups.com', 'norman@njclarke.com']
spec.description = <<-END
Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML
that's designed to express the structure of XHTML or XML documents
Expand Down
2 changes: 2 additions & 0 deletions lib/haml/helpers/action_view_mods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,5 @@ def form_for_with_haml(object_name, *args, &proc)
end
end
end

require "haml/helpers/rails_323_textarea_fix" if Haml::Util.ap_geq?("3.2.3")
49 changes: 49 additions & 0 deletions lib/haml/helpers/rails_323_textarea_fix.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Rails 3.2.3's form helpers add a newline after opening textareas, which can
# cause problems with newlines being considered content rather than markup.
# These changes fix the issue by making the helpers emit "<haml:newline/>"
# rather than the leading newline. The tag is then replaced by a newline after
# rendering.
#
# This should be considered nothing more than an emergency hotfix to ensure
# compatibility with the latest version of Rails, made at a moment when the Haml
# project is transitioning to a new maintainer.

module AbstractController
module Rendering
def render_to_body_with_haml(options = {})
if rendered = render_to_body_without_haml(options)
rendered.gsub('<haml:newline/>', "\n").html_safe
end
end
alias_method_chain :render_to_body, :haml
end
end

module ActionView

class Renderer
def render_template_with_haml(context, options)
if rendered = render_template_without_haml(context, options)
rendered.gsub('<haml:newline/>', "\n").html_safe
end
end
alias_method_chain :render_template, :haml
end

module Helpers
module TagHelper
private

def content_tag_string_with_haml(name, content, options, escape = true)
if name.to_sym == :textarea
tag_options = tag_options(options, escape) if options
content = ERB::Util.h(content) if escape
"<#{name}#{tag_options}><haml:newline/>#{content}</#{name}>".html_safe
else
content_tag_string_without_haml(name, content, options, escape)
end
end
alias_method_chain :content_tag_string, :haml
end
end
end
3 changes: 1 addition & 2 deletions test/gemfiles/.bundle/config
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
--- {}
93 changes: 46 additions & 47 deletions test/gemfiles/Gemfile.rails-3.1.x.lock
Original file line number Diff line number Diff line change
@@ -1,90 +1,89 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.0)
actionpack (= 3.1.0)
actionmailer (3.1.4)
actionpack (= 3.1.4)
mail (~> 2.3.0)
actionpack (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
actionpack (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.0.3)
rack (~> 1.3.6)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.0)
activemodel (3.1.0)
activesupport (= 3.1.0)
bcrypt-ruby (~> 3.0.0)
sprockets (~> 2.0.3)
activemodel (3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
arel (~> 2.2.1)
activerecord (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
activeresource (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
activesupport (3.1.0)
activeresource (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
activesupport (3.1.4)
multi_json (~> 1.0)
arel (2.2.1)
bcrypt-ruby (3.0.1)
arel (2.2.3)
builder (3.0.0)
erubis (2.7.0)
hike (1.2.1)
hpricot (0.8.4)
hpricot (0.8.6)
i18n (0.6.0)
json (1.6.1)
mail (2.3.0)
json (1.6.6)
mail (2.3.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.3)
rack-cache (1.0.3)
mime-types (1.18)
multi_json (1.2.0)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.0)
actionmailer (= 3.1.0)
actionpack (= 3.1.0)
activerecord (= 3.1.0)
activeresource (= 3.1.0)
activesupport (= 3.1.0)
rails (3.1.4)
actionmailer (= 3.1.4)
actionpack (= 3.1.4)
activerecord (= 3.1.4)
activeresource (= 3.1.4)
activesupport (= 3.1.4)
bundler (~> 1.0)
railties (= 3.1.0)
railties (3.1.0)
actionpack (= 3.1.0)
activesupport (= 3.1.0)
railties (= 3.1.4)
railties (3.1.4)
actionpack (= 3.1.4)
activesupport (= 3.1.4)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
ruby_parser (2.3.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
sass (3.1.7)
sexp_processor (3.0.6)
sprockets (2.0.0)
sass (3.1.15)
sexp_processor (3.1.0)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
tilt (~> 1.1, != 1.3.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
tzinfo (0.3.33)

PLATFORMS
ruby
Expand Down
8 changes: 8 additions & 0 deletions test/gemfiles/Gemfile.rails-3.2.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source :rubygems

gem 'json'
gem 'ruby_parser'
gem 'hpricot'
gem 'erubis'
gem 'sass'
gem 'rails', '>= 3.2.0', '< 3.3.0'
95 changes: 95 additions & 0 deletions test/gemfiles/Gemfile.rails-3.2.x.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.3)
actionpack (= 3.2.3)
mail (~> 2.4.4)
actionpack (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
activerecord (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
erubis (2.7.0)
hike (1.2.1)
hpricot (0.8.6)
i18n (0.6.0)
journey (1.0.3)
json (1.6.6)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.18)
multi_json (1.2.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.3)
actionmailer (= 3.2.3)
actionpack (= 3.2.3)
activerecord (= 3.2.3)
activeresource (= 3.2.3)
activesupport (= 3.2.3)
bundler (~> 1.0)
railties (= 3.2.3)
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
sass (3.1.15)
sexp_processor (3.1.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)

PLATFORMS
ruby

DEPENDENCIES
erubis
hpricot
json
rails (>= 3.2.0, < 3.3.0)
ruby_parser
sass
Loading

0 comments on commit ad8bd7b

Please sign in to comment.