haml-edge 2.3.47 → 2.3.48
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/VERSION +1 -1
- data/lib/sass/tree/prop_node.rb +35 -23
- data/lib/sass/tree/rule_node.rb +3 -0
- data/test/sass/engine_test.rb +26 -1
- metadata +4 -4
data/EDGE_GEM_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.48
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.48
|
data/lib/sass/tree/prop_node.rb
CHANGED
|
@@ -14,6 +14,18 @@ module Sass::Tree
|
|
|
14
14
|
# @return [String, Script::Node]
|
|
15
15
|
attr_accessor :value
|
|
16
16
|
|
|
17
|
+
# How deep this property is indented
|
|
18
|
+
# relative to a normal property.
|
|
19
|
+
# This is only greater than 0 in the case that:
|
|
20
|
+
#
|
|
21
|
+
# * This node is in a static tree
|
|
22
|
+
# * The style is :nested
|
|
23
|
+
# * This is a child property of another property
|
|
24
|
+
# * The parent property has a value, and thus will be rendered
|
|
25
|
+
#
|
|
26
|
+
# @return [Fixnum]
|
|
27
|
+
attr_accessor :indentation
|
|
28
|
+
|
|
17
29
|
# @param name [String] See \{#name}
|
|
18
30
|
# @param value [String] See \{#value}
|
|
19
31
|
# @param prop_syntax [Symbol] `:new` if this property uses `a: b`-style syntax,
|
|
@@ -21,6 +33,7 @@ module Sass::Tree
|
|
|
21
33
|
def initialize(name, value, prop_syntax)
|
|
22
34
|
@name = name
|
|
23
35
|
@value = value
|
|
36
|
+
@indentation = 0
|
|
24
37
|
@prop_syntax = prop_syntax
|
|
25
38
|
super()
|
|
26
39
|
end
|
|
@@ -39,43 +52,36 @@ module Sass::Tree
|
|
|
39
52
|
# Computes the CSS for the property.
|
|
40
53
|
#
|
|
41
54
|
# @param tabs [Fixnum] The level of indentation for the CSS
|
|
42
|
-
# @param parent_name [String] The name of the parent property (e.g. `text`) or nil
|
|
43
55
|
# @return [String] The resulting CSS
|
|
44
56
|
# @raise [Sass::SyntaxError] if the property uses invalid syntax
|
|
45
|
-
def _to_s(tabs
|
|
57
|
+
def _to_s(tabs)
|
|
46
58
|
if @options[:property_syntax] == :old && @prop_syntax == :new
|
|
47
59
|
raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.")
|
|
48
60
|
elsif @options[:property_syntax] == :new && @prop_syntax == :old
|
|
49
61
|
raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.")
|
|
50
62
|
elsif value[-1] == ?;
|
|
51
63
|
raise Sass::SyntaxError.new("Invalid property: #{declaration.dump} (no \";\" required at end-of-line).")
|
|
52
|
-
elsif value.empty?
|
|
64
|
+
elsif value.empty?
|
|
53
65
|
raise Sass::SyntaxError.new("Invalid property: #{declaration.dump} (no value).")
|
|
54
66
|
end
|
|
55
67
|
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
to_return = ' ' * (tabs - 1 + indentation) + name + ":" +
|
|
69
|
+
(style == :compressed ? '' : ' ') + value + (style == :compressed ? "" : ";")
|
|
70
|
+
end
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if !value.empty?
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
children.each do |kid|
|
|
71
|
-
next if kid.invisible?
|
|
72
|
-
to_return << kid.to_s(tabs, real_name) << join_string
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
(style == :compressed && parent_name) ? to_return : to_return[0...-1]
|
|
72
|
+
# Returns this node's fully-resolved child properties, and/or this node.
|
|
73
|
+
#
|
|
74
|
+
# @param environment [Sass::Environment] The lexical environment containing
|
|
75
|
+
# variable and mixin values
|
|
76
|
+
def _perform(environment)
|
|
77
|
+
node = super
|
|
78
|
+
result = node.children.dup
|
|
79
|
+
result.unshift(node) if !node.value.empty? || node.children.empty?
|
|
80
|
+
result
|
|
76
81
|
end
|
|
77
82
|
|
|
78
|
-
# Runs any SassScript that may be embedded in the property
|
|
83
|
+
# Runs any SassScript that may be embedded in the property,
|
|
84
|
+
# and invludes the parent property, if any.
|
|
79
85
|
#
|
|
80
86
|
# @param environment [Sass::Environment] The lexical environment containing
|
|
81
87
|
# variable and mixin values
|
|
@@ -83,6 +89,12 @@ module Sass::Tree
|
|
|
83
89
|
@name = interpolate(@name, environment)
|
|
84
90
|
@value = @value.is_a?(String) ? interpolate(@value, environment) : @value.perform(environment).to_s
|
|
85
91
|
super
|
|
92
|
+
# Once we've called super, the child nodes have been dup'ed
|
|
93
|
+
# so we can destructively modify them
|
|
94
|
+
children.select {|c| c.is_a?(PropNode)}.each do |c|
|
|
95
|
+
c.name = "#{name}-#{c.name}"
|
|
96
|
+
c.indentation += 1 if style == :nested && !@value.empty?
|
|
97
|
+
end
|
|
86
98
|
end
|
|
87
99
|
|
|
88
100
|
# Returns an error message if the given child node is invalid,
|
data/lib/sass/tree/rule_node.rb
CHANGED
data/test/sass/engine_test.rb
CHANGED
|
@@ -27,7 +27,7 @@ class SassEngineTest < Test::Unit::TestCase
|
|
|
27
27
|
"a\n b: c;" => 'Invalid property: "b: c;" (no ";" required at end-of-line).',
|
|
28
28
|
"a\n b : c" => 'Invalid property: "b : c".',
|
|
29
29
|
"a\n b=c: d" => 'Invalid property: "b=c: d".',
|
|
30
|
-
":
|
|
30
|
+
"a: b" => 'Properties aren\'t allowed at the root of a document.',
|
|
31
31
|
"!" => 'Invalid variable: "!".',
|
|
32
32
|
"!a" => 'Invalid variable: "!a".',
|
|
33
33
|
"! a" => 'Invalid variable: "! a".',
|
|
@@ -463,6 +463,31 @@ SASS
|
|
|
463
463
|
assert_equal("foo {\n a: b;\n c: d;\n e: f; }\n", render("foo\r a: b\r\n c: d\n\r e: f"))
|
|
464
464
|
end
|
|
465
465
|
|
|
466
|
+
def test_property_with_content_and_nested_props
|
|
467
|
+
assert_equal(<<CSS, render(<<SASS))
|
|
468
|
+
foo {
|
|
469
|
+
a: b;
|
|
470
|
+
a-c: d;
|
|
471
|
+
a-c-e: f; }
|
|
472
|
+
CSS
|
|
473
|
+
foo
|
|
474
|
+
a: b
|
|
475
|
+
c: d
|
|
476
|
+
e: f
|
|
477
|
+
SASS
|
|
478
|
+
|
|
479
|
+
assert_equal(<<CSS, render(<<SASS))
|
|
480
|
+
foo {
|
|
481
|
+
a: b;
|
|
482
|
+
a-c-e: f; }
|
|
483
|
+
CSS
|
|
484
|
+
foo
|
|
485
|
+
a: b
|
|
486
|
+
c:
|
|
487
|
+
e: f
|
|
488
|
+
SASS
|
|
489
|
+
end
|
|
490
|
+
|
|
466
491
|
def test_or_eq
|
|
467
492
|
assert_equal("foo {\n a: b; }\n", render(%Q{!foo = "b"\n!foo ||= "c"\nfoo\n a = !foo}))
|
|
468
493
|
assert_equal("foo {\n a: b; }\n", render(%Q{!foo ||= "b"\nfoo\n a = !foo}))
|
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.48
|
|
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-10-
|
|
13
|
+
date: 2009-10-14 00:00:00 -04:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -152,8 +152,8 @@ files:
|
|
|
152
152
|
- test/haml/rhtml/action_view.rhtml
|
|
153
153
|
- test/haml/rhtml/standard.rhtml
|
|
154
154
|
- test/haml/spec
|
|
155
|
-
- test/haml/spec_test.rb
|
|
156
155
|
- test/haml/template_test.rb
|
|
156
|
+
- test/haml/spec_test.rb
|
|
157
157
|
- test/haml/templates
|
|
158
158
|
- test/haml/templates/_av_partial_1.haml
|
|
159
159
|
- test/haml/templates/_av_partial_1_ugly.haml
|
|
@@ -300,8 +300,8 @@ test_files:
|
|
|
300
300
|
- test/haml/engine_test.rb
|
|
301
301
|
- test/haml/helper_test.rb
|
|
302
302
|
- test/haml/html2haml_test.rb
|
|
303
|
-
- test/haml/spec_test.rb
|
|
304
303
|
- test/haml/template_test.rb
|
|
304
|
+
- test/haml/spec_test.rb
|
|
305
305
|
- test/haml/util_test.rb
|
|
306
306
|
- test/sass/css2sass_test.rb
|
|
307
307
|
- test/sass/engine_test.rb
|