haml-edge 2.3.59 → 2.3.60

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.59
1
+ 2.3.60
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.59
1
+ 2.3.60
@@ -85,7 +85,7 @@ module Haml
85
85
  DOCTYPE_REGEX = /(\d\.\d)?[\s]*([a-z]*)/i
86
86
 
87
87
  # The Regex that matches a literal string or symbol value
88
- LITERAL_VALUE_REGEX = /:(\w*)|(["'])([^\\#'"]|\\.)*\2/
88
+ LITERAL_VALUE_REGEX = /:(\w*)|(["'])((?![\\#]|\2).|\\.)*\2/
89
89
 
90
90
  private
91
91
 
@@ -727,6 +727,7 @@ END
727
727
  raise SyntaxError.new("Self-closing tags can't have content.", last_line - 1) if self_closing && !value.empty?
728
728
 
729
729
  self_closing ||= !!( !block_opened? && value.empty? && @options[:autoclose].include?(tag_name) )
730
+ value = nil if value.empty? && (block_opened? || self_closing)
730
731
 
731
732
  dont_indent_next_line =
732
733
  (nuke_outer_whitespace && !block_opened?) ||
@@ -751,7 +752,7 @@ END
751
752
  return if tag_closed
752
753
  else
753
754
  flush_merged_text
754
- content = value.empty? || parse ? 'nil' : value.dump
755
+ content = parse ? 'nil' : value.inspect
755
756
  if attributes_hashes.empty?
756
757
  attributes_hashes = ''
757
758
  elsif attributes_hashes.size == 1
@@ -769,7 +770,7 @@ END
769
770
 
770
771
  return if self_closing
771
772
 
772
- if value.empty?
773
+ if value.nil?
773
774
  push_and_tabulate([:element, [tag_name, nuke_outer_whitespace, nuke_inner_whitespace]])
774
775
  @output_tabs += 1 unless nuke_inner_whitespace
775
776
  return
@@ -128,6 +128,17 @@ class EngineTest < Test::Unit::TestCase
128
128
  assert_equal("<p class='3'>foo</p>", render("%p{:class => 1+2} foo").chomp)
129
129
  end
130
130
 
131
+ def test_dynamic_attributes_with_no_content
132
+ assert_equal(<<HTML, render(<<HAML))
133
+ <p>
134
+ <a href='http://haml-lang.com'></a>
135
+ </p>
136
+ HTML
137
+ %p
138
+ %a{:href => "http://" + "haml-lang.com"}
139
+ HAML
140
+ end
141
+
131
142
  def test_nil_should_render_empty_tag
132
143
  assert_equal("<div class='no_attributes'></div>",
133
144
  render(".no_attributes{:nil => nil}").chomp)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.59
4
+ version: 2.3.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -65,9 +65,9 @@ files:
65
65
  - lib/haml/helpers/action_view_mods.rb
66
66
  - lib/haml/helpers/xss_mods.rb
67
67
  - lib/haml/html.rb
68
+ - lib/haml/precompiler.rb
68
69
  - lib/haml/html
69
70
  - lib/haml/html/erb.rb
70
- - lib/haml/precompiler.rb
71
71
  - lib/haml/shared.rb
72
72
  - lib/haml/template.rb
73
73
  - lib/haml/template
@@ -124,13 +124,13 @@ files:
124
124
  - test/benchmark.rb
125
125
  - test/haml
126
126
  - test/haml/engine_test.rb
127
+ - test/haml/helper_test.rb
128
+ - test/haml/html2haml_test.rb
127
129
  - test/haml/erb
128
130
  - test/haml/erb/_av_partial_1.erb
129
131
  - test/haml/erb/_av_partial_2.erb
130
132
  - test/haml/erb/action_view.erb
131
133
  - test/haml/erb/standard.rhtml
132
- - test/haml/helper_test.rb
133
- - test/haml/html2haml_test.rb
134
134
  - test/haml/markaby
135
135
  - test/haml/markaby/standard.mab
136
136
  - test/haml/mocks
@@ -155,7 +155,7 @@ files:
155
155
  - test/haml/results/very_basic.xhtml
156
156
  - test/haml/results/whitespace_handling.xhtml
157
157
  - test/haml/spec
158
- - test/haml/spec_test.rb
158
+ - test/haml/util_test.rb
159
159
  - test/haml/template_test.rb
160
160
  - test/haml/templates
161
161
  - test/haml/templates/_av_partial_1.haml
@@ -189,7 +189,7 @@ files:
189
189
  - test/haml/templates/tag_parsing.haml
190
190
  - test/haml/templates/very_basic.haml
191
191
  - test/haml/templates/whitespace_handling.haml
192
- - test/haml/util_test.rb
192
+ - test/haml/spec_test.rb
193
193
  - test/linked_rails.rb
194
194
  - test/sass
195
195
  - test/sass/css2sass_test.rb
@@ -303,9 +303,9 @@ test_files:
303
303
  - test/haml/engine_test.rb
304
304
  - test/haml/helper_test.rb
305
305
  - test/haml/html2haml_test.rb
306
- - test/haml/spec_test.rb
307
- - test/haml/template_test.rb
308
306
  - test/haml/util_test.rb
307
+ - test/haml/template_test.rb
308
+ - test/haml/spec_test.rb
309
309
  - test/sass/css2sass_test.rb
310
310
  - test/sass/engine_test.rb
311
311
  - test/sass/functions_test.rb