haml-edge 2.3.43 → 2.3.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EDGE_GEM_VERSION +1 -1
- data/Rakefile +12 -2
- data/VERSION +1 -1
- data/extra/haml-mode.el +1 -1
- data/extra/sass-mode.el +2 -1
- data/lib/haml/engine.rb +3 -2
- data/lib/haml/html.rb +2 -1
- data/lib/haml/precompiler.rb +26 -10
- data/test/haml/engine_test.rb +61 -0
- data/test/haml/html2haml_test.rb +22 -0
- metadata +6 -6
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.44
|
data/Rakefile
CHANGED
@@ -90,6 +90,11 @@ task :release_elpa do
|
|
90
90
|
next if haml_unchanged && sass_unchanged
|
91
91
|
raise "haml-mode.el and sass-mode.el are out of sync." if haml_unchanged ^ sass_unchanged
|
92
92
|
|
93
|
+
if sass_unchanged && File.read("extra/sass-mode.el").
|
94
|
+
include?(";; Package-Requires: ((haml-mode #{sass_unchanged.inspect}))")
|
95
|
+
raise "sass-mode.el doesn't require the same version of haml-mode."
|
96
|
+
end
|
97
|
+
|
93
98
|
rev = File.read('.git/HEAD').strip
|
94
99
|
if rev =~ /^ref: (.*)$/
|
95
100
|
rev = File.read(".git/#{$1}").strip
|
@@ -151,10 +156,11 @@ end
|
|
151
156
|
#
|
152
157
|
# @param mode [String, Symbol] The name of the mode
|
153
158
|
# @param version [String] The version number
|
159
|
+
# @return [String, nil] The version number if the version has changed
|
154
160
|
def mode_unchanged?(mode, version)
|
155
161
|
mode_version = File.read("extra/#{mode}-mode.el").scan(/^;; Version: (.*)$/).first.first
|
156
162
|
return false if mode_version == version
|
157
|
-
return
|
163
|
+
return mode_version unless changed_since?(mode_version, "extra/#{mode}-mode.el")
|
158
164
|
raise "#{mode}-mode.el version is #{version.inspect}, but it has changed as of #{version.inspect}"
|
159
165
|
return false
|
160
166
|
end
|
@@ -242,8 +248,12 @@ task :pages do
|
|
242
248
|
sh %{git checkout #{proj}-pages}
|
243
249
|
sh %{git reset --hard origin/#{proj}-pages}
|
244
250
|
|
251
|
+
Dir.chdir("/var/www/#{proj}-pages")
|
252
|
+
sh %{git fetch origin}
|
253
|
+
sh %{git reset --hard origin/#{proj}-pages}
|
245
254
|
sh %{rake build --trace}
|
246
|
-
sh %{
|
255
|
+
sh %{mkdir -p tmp}
|
256
|
+
sh %{touch tmp/restart.txt}
|
247
257
|
end
|
248
258
|
end
|
249
259
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.44
|
data/extra/haml-mode.el
CHANGED
data/extra/sass-mode.el
CHANGED
@@ -4,10 +4,11 @@
|
|
4
4
|
|
5
5
|
;; Author: Nathan Weizenbaum
|
6
6
|
;; URL: http://github.com/nex3/haml/tree/master
|
7
|
-
;; Version: 2.2.
|
7
|
+
;; Version: 2.2.7
|
8
8
|
;; Created: 2007-03-15
|
9
9
|
;; By: Nathan Weizenbaum
|
10
10
|
;; Keywords: markup, language, css
|
11
|
+
;; Package-Requires: ((haml-mode "2.2.7"))
|
11
12
|
|
12
13
|
;;; Commentary:
|
13
14
|
|
data/lib/haml/engine.rb
CHANGED
@@ -72,9 +72,10 @@ module Haml
|
|
72
72
|
:suppress_eval => false,
|
73
73
|
:attr_wrapper => "'",
|
74
74
|
|
75
|
-
# Don't forget to update the docs in
|
75
|
+
# Don't forget to update the docs in doc-src/HAML_REFERENCE.md
|
76
|
+
# if you update these
|
76
77
|
:autoclose => %w[meta img link br hr input area param col base],
|
77
|
-
:preserve => %w[textarea pre],
|
78
|
+
:preserve => %w[textarea pre code],
|
78
79
|
|
79
80
|
:filename => '(haml)',
|
80
81
|
:line => 1,
|
data/lib/haml/html.rb
CHANGED
@@ -25,6 +25,7 @@ module Haml
|
|
25
25
|
|
26
26
|
def parse_text(text, tabs)
|
27
27
|
text.strip!
|
28
|
+
text.gsub!('#{', '\#{') #'
|
28
29
|
if text.empty?
|
29
30
|
String.new
|
30
31
|
else
|
@@ -202,7 +203,7 @@ module Haml
|
|
202
203
|
full_match = nil
|
203
204
|
ruby_value = value.gsub(%r{<haml:loud>\s*(.+?)\s*</haml:loud>}) do
|
204
205
|
full_match = $`.empty? && $'.empty?
|
205
|
-
full_match ? $1: "\#{#{$1}}"
|
206
|
+
CGI.unescapeHTML(full_match ? $1: "\#{#{$1}}")
|
206
207
|
end
|
207
208
|
next if ruby_value == value
|
208
209
|
[name, full_match ? ruby_value : %("#{ruby_value}")]
|
data/lib/haml/precompiler.rb
CHANGED
@@ -186,7 +186,7 @@ END
|
|
186
186
|
return unless line.tabs <= @template_tabs && @template_tabs > 0
|
187
187
|
|
188
188
|
to_close = @template_tabs - line.tabs
|
189
|
-
to_close.times {
|
189
|
+
to_close.times {|i| close unless to_close - 1 - i == 0 && mid_block_keyword?(line.text)}
|
190
190
|
end
|
191
191
|
|
192
192
|
# Processes a single line of Haml.
|
@@ -228,12 +228,27 @@ END
|
|
228
228
|
newline_now
|
229
229
|
|
230
230
|
# Handle stuff like - end.join("|")
|
231
|
-
@to_close_stack.
|
231
|
+
@to_close_stack.last << false if text =~ /^-\s*end\b/ && !block_opened?
|
232
232
|
|
233
233
|
case_stmt = text =~ /^-\s*case\b/
|
234
|
-
|
235
|
-
|
236
|
-
|
234
|
+
keyword = mid_block_keyword?(text)
|
235
|
+
block = block_opened? && !keyword
|
236
|
+
|
237
|
+
# It's important to preserve tabulation modification for keywords
|
238
|
+
# that involve choosing between posible blocks of code.
|
239
|
+
if %w[else elsif when].include?(keyword)
|
240
|
+
@dont_indent_next_line, @dont_tab_up_next_text = @to_close_stack.last[1..2]
|
241
|
+
|
242
|
+
# when is unusual in that either it will be indented twice,
|
243
|
+
# or the case won't have created its own indentation
|
244
|
+
if keyword == "when"
|
245
|
+
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text, false])
|
246
|
+
end
|
247
|
+
elsif block || case_stmt
|
248
|
+
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
249
|
+
elsif block && case_stmt
|
250
|
+
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
251
|
+
end
|
237
252
|
when FILTER; start_filtered(text[1..-1].downcase)
|
238
253
|
when DOCTYPE
|
239
254
|
return render_doctype(text) if text[0...3] == '!!!'
|
@@ -247,10 +262,11 @@ END
|
|
247
262
|
end
|
248
263
|
end
|
249
264
|
|
250
|
-
#
|
251
|
-
# of
|
265
|
+
# If the text is a silent script text with one of Ruby's mid-block keywords,
|
266
|
+
# returns the name of that keyword.
|
267
|
+
# Otherwise, returns nil.
|
252
268
|
def mid_block_keyword?(text)
|
253
|
-
MID_BLOCK_KEYWORD_REGEX
|
269
|
+
text[MID_BLOCK_KEYWORD_REGEX, 1]
|
254
270
|
end
|
255
271
|
|
256
272
|
# Evaluates <tt>text</tt> in the context of the scope object, but
|
@@ -398,7 +414,7 @@ END
|
|
398
414
|
end
|
399
415
|
|
400
416
|
# Closes a Ruby block.
|
401
|
-
def close_script(push_end = true)
|
417
|
+
def close_script(_1, _2, push_end = true)
|
402
418
|
push_silent("end", true) if push_end
|
403
419
|
@template_tabs -= 1
|
404
420
|
end
|
@@ -433,7 +449,7 @@ END
|
|
433
449
|
@template_tabs -= 1
|
434
450
|
end
|
435
451
|
|
436
|
-
def close_nil
|
452
|
+
def close_nil(*args)
|
437
453
|
@template_tabs -= 1
|
438
454
|
end
|
439
455
|
|
data/test/haml/engine_test.rb
CHANGED
@@ -232,6 +232,19 @@ HAML
|
|
232
232
|
SOURCE
|
233
233
|
end
|
234
234
|
|
235
|
+
def test_pre_code
|
236
|
+
assert_equal(<<HTML, render(<<HAML))
|
237
|
+
<pre><code>Foo
 bar
 baz</code></pre>
|
238
|
+
HTML
|
239
|
+
%pre
|
240
|
+
%code
|
241
|
+
:preserve
|
242
|
+
Foo
|
243
|
+
bar
|
244
|
+
baz
|
245
|
+
HAML
|
246
|
+
end
|
247
|
+
|
235
248
|
def test_boolean_attributes
|
236
249
|
assert_equal("<p bar baz='true' foo='bar'></p>\n",
|
237
250
|
render("%p{:foo => 'bar', :bar => true, :baz => 'true'}", :format => :html4))
|
@@ -268,6 +281,36 @@ HTML
|
|
268
281
|
HAML
|
269
282
|
end
|
270
283
|
|
284
|
+
def test_whitespace_nuke_with_tags_and_else
|
285
|
+
assert_equal(<<HTML, render(<<HAML))
|
286
|
+
<a>
|
287
|
+
<b>foo</b>
|
288
|
+
</a>
|
289
|
+
HTML
|
290
|
+
%a
|
291
|
+
%b<
|
292
|
+
- if false
|
293
|
+
= "foo"
|
294
|
+
- else
|
295
|
+
foo
|
296
|
+
HAML
|
297
|
+
|
298
|
+
assert_equal(<<HTML, render(<<HAML))
|
299
|
+
<a>
|
300
|
+
<b>
|
301
|
+
foo
|
302
|
+
</b>
|
303
|
+
</a>
|
304
|
+
HTML
|
305
|
+
%a
|
306
|
+
%b
|
307
|
+
- if false
|
308
|
+
= "foo"
|
309
|
+
- else
|
310
|
+
foo
|
311
|
+
HAML
|
312
|
+
end
|
313
|
+
|
271
314
|
def test_both_case_indentation_work_with_deeply_nested_code
|
272
315
|
result = <<RESULT
|
273
316
|
<h2>
|
@@ -334,6 +377,24 @@ HTML
|
|
334
377
|
HAML
|
335
378
|
end
|
336
379
|
|
380
|
+
def test_nested_end_with_method_call
|
381
|
+
assert_equal(<<HTML, render(<<HAML))
|
382
|
+
<p>
|
383
|
+
2|3|4
|
384
|
+
b-a-r
|
385
|
+
</p>
|
386
|
+
HTML
|
387
|
+
%p
|
388
|
+
= [1, 2, 3].map do |i|
|
389
|
+
- i + 1
|
390
|
+
- end.join("|")
|
391
|
+
= "bar".gsub(/./) do |s|
|
392
|
+
- s + "-"
|
393
|
+
- end.gsub(/-$/) do |s|
|
394
|
+
- ''
|
395
|
+
HAML
|
396
|
+
end
|
397
|
+
|
337
398
|
def test_silent_end_with_stuff
|
338
399
|
assert_equal(<<HTML, render(<<HAML))
|
339
400
|
e
|
data/test/haml/html2haml_test.rb
CHANGED
@@ -32,6 +32,14 @@ class Html2HamlTest < Test::Unit::TestCase
|
|
32
32
|
assert_equal "/\n IE sucks", render('<!-- IE sucks -->')
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_interpolation
|
36
|
+
assert_equal('Foo \#{bar} baz', render('Foo #{bar} baz'))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_interpolation_in_attrs
|
40
|
+
assert_equal('%p{ :foo => "\#{bar} baz" }', render('<p foo="#{bar} baz"></p>'))
|
41
|
+
end
|
42
|
+
|
35
43
|
def test_rhtml
|
36
44
|
assert_equal '- foo = bar', render_rhtml('<% foo = bar %>')
|
37
45
|
assert_equal '- foo = bar', render_rhtml('<% foo = bar -%>')
|
@@ -64,6 +72,11 @@ class Html2HamlTest < Test::Unit::TestCase
|
|
64
72
|
render_rhtml(%Q{<div class="<%= 12 %>!">Bang!</div>})
|
65
73
|
end
|
66
74
|
|
75
|
+
def test_rhtml_in_html_escaped_attribute
|
76
|
+
assert_equal %(%div{ :class => "foo" }\n Bang!),
|
77
|
+
render_rhtml(%Q{<div class="<%= "foo" %>">Bang!</div>})
|
78
|
+
end
|
79
|
+
|
67
80
|
def test_rhtml_in_attribute_to_multiple_interpolations
|
68
81
|
assert_equal %(%div{ :class => "\#{12} + \#{13}" }\n Math is super),
|
69
82
|
render_rhtml(%Q{<div class="<%= 12 %> + <%= 13 %>">Math is super</div>})
|
@@ -90,6 +103,15 @@ HAML
|
|
90
103
|
HTML
|
91
104
|
end
|
92
105
|
|
106
|
+
def test_interpolation_in_rhtml
|
107
|
+
assert_equal('= "Foo #{bar} baz"', render_rhtml('<%= "Foo #{bar} baz" %>'))
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_interpolation_in_rhtml_attrs
|
111
|
+
assert_equal('%p{ :foo => "#{bar} baz" }',
|
112
|
+
render_rhtml('<p foo="<%= "#{bar} baz" %>"></p>'))
|
113
|
+
end
|
114
|
+
|
93
115
|
# Encodings
|
94
116
|
|
95
117
|
unless Haml::Util.ruby1_8?
|
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.
|
4
|
+
version: 2.3.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-09
|
13
|
+
date: 2009-10-09 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -44,11 +44,11 @@ extensions: []
|
|
44
44
|
|
45
45
|
extra_rdoc_files:
|
46
46
|
- README.md
|
47
|
+
- REVISION
|
47
48
|
- VERSION
|
49
|
+
- VERSION_NAME
|
48
50
|
- CONTRIBUTING
|
49
51
|
- MIT-LICENSE
|
50
|
-
- VERSION_NAME
|
51
|
-
- REVISION
|
52
52
|
- EDGE_GEM_VERSION
|
53
53
|
files:
|
54
54
|
- rails/init.rb
|
@@ -257,11 +257,11 @@ files:
|
|
257
257
|
- init.rb
|
258
258
|
- .yardopts
|
259
259
|
- README.md
|
260
|
+
- REVISION
|
260
261
|
- VERSION
|
262
|
+
- VERSION_NAME
|
261
263
|
- CONTRIBUTING
|
262
264
|
- MIT-LICENSE
|
263
|
-
- VERSION_NAME
|
264
|
-
- REVISION
|
265
265
|
- EDGE_GEM_VERSION
|
266
266
|
has_rdoc: true
|
267
267
|
homepage: http://haml.hamptoncatlin.com/
|