haml-edge 2.3.78 → 2.3.79
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/haml/helpers.rb +3 -1
- data/lib/haml/util.rb +11 -0
- data/test/haml/engine_test.rb +5 -0
- data/test/haml/util_test.rb +10 -0
- data/test/test_helper.rb +2 -5
- metadata +2 -2
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.79
|
data/Rakefile
CHANGED
@@ -319,11 +319,11 @@ rescue LoadError; end
|
|
319
319
|
# ----- Testing Multiple Rails Versions -----
|
320
320
|
|
321
321
|
rails_versions = [
|
322
|
-
"v2.3.
|
322
|
+
"v2.3.4",
|
323
323
|
"v2.2.2",
|
324
324
|
"v2.1.2",
|
325
|
-
"v2.0.5"
|
326
325
|
]
|
326
|
+
rails_versions << "v2.0.5" if RUBY_VERSION =~ /^1\.8/
|
327
327
|
|
328
328
|
namespace :test do
|
329
329
|
desc "Test all supported versions of rails. This takes a while."
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.79
|
data/lib/haml/helpers.rb
CHANGED
@@ -483,7 +483,9 @@ END
|
|
483
483
|
# @param text [String] The string to sanitize
|
484
484
|
# @return [String] The sanitized string
|
485
485
|
def escape_once(text)
|
486
|
-
|
486
|
+
Haml::Util.silence_warnings do
|
487
|
+
text.to_s.gsub(/[\"><]|&(?!(?:[a-zA-Z]+|(#\d+));)/n) {|s| HTML_ESCAPE[s]}
|
488
|
+
end
|
487
489
|
end
|
488
490
|
|
489
491
|
# Returns whether or not the current template is a Haml template.
|
data/lib/haml/util.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'set'
|
3
3
|
require 'enumerator'
|
4
|
+
require 'stringio'
|
4
5
|
|
5
6
|
module Haml
|
6
7
|
# A module containing various useful functions.
|
@@ -133,6 +134,16 @@ module Haml
|
|
133
134
|
info
|
134
135
|
end
|
135
136
|
|
137
|
+
# Silence all output to STDERR within a block.
|
138
|
+
#
|
139
|
+
# @yield A block in which no output will be printed to STDERR
|
140
|
+
def silence_warnings
|
141
|
+
the_real_stderr, $stderr = $stderr, StringIO.new
|
142
|
+
yield
|
143
|
+
ensure
|
144
|
+
$stderr = the_real_stderr
|
145
|
+
end
|
146
|
+
|
136
147
|
## Cross Rails Version Compatibility
|
137
148
|
|
138
149
|
# Returns the root of the Rails application,
|
data/test/haml/engine_test.rb
CHANGED
@@ -1044,6 +1044,11 @@ END
|
|
1044
1044
|
assert_equal("<a></a>\n", render('%a{:b => "a #{1 + 1} b", :c => "d"}', :suppress_eval => true))
|
1045
1045
|
end
|
1046
1046
|
|
1047
|
+
def test_utf8_attrs
|
1048
|
+
assert_equal("<a href='héllo'></a>\n", render("%a{:href => 'héllo'}"))
|
1049
|
+
assert_equal("<a href='héllo'></a>\n", render("%a(href='héllo')"))
|
1050
|
+
end
|
1051
|
+
|
1047
1052
|
# HTML 4.0
|
1048
1053
|
|
1049
1054
|
def test_html_has_no_self_closing_tags
|
data/test/haml/util_test.rb
CHANGED
@@ -59,6 +59,16 @@ class UtilTest < Test::Unit::TestCase
|
|
59
59
|
merge_adjacent_strings(["foo ", "bar ", "baz", :bang, "biz", " bop", 12]))
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_silence_warnings
|
63
|
+
old_stderr, $stderr = $stderr, StringIO.new
|
64
|
+
warn "Out"
|
65
|
+
assert_equal("Out\n", $stderr.string)
|
66
|
+
silence_warnings {warn "In"}
|
67
|
+
assert_equal("Out\n", $stderr.string)
|
68
|
+
ensure
|
69
|
+
$stderr = old_stderr
|
70
|
+
end
|
71
|
+
|
62
72
|
def test_has
|
63
73
|
assert(has?(:instance_method, String, :chomp!))
|
64
74
|
assert(has?(:private_instance_method, Haml::Engine, :set_locals))
|
data/test/test_helper.rb
CHANGED
@@ -30,10 +30,7 @@ class Test::Unit::TestCase
|
|
30
30
|
$stderr = the_real_stderr
|
31
31
|
end
|
32
32
|
|
33
|
-
def silence_warnings
|
34
|
-
|
35
|
-
yield
|
36
|
-
ensure
|
37
|
-
$stderr = the_real_stderr
|
33
|
+
def silence_warnings(&block)
|
34
|
+
Haml::Util.silence_warnings(&block)
|
38
35
|
end
|
39
36
|
end
|
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.79
|
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-11-
|
13
|
+
date: 2009-11-11 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|