less 1.1.13 → 1.2.9
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/Rakefile +13 -41
- data/VERSION +1 -1
- data/bin/lessc +8 -2
- data/less.gemspec +13 -92
- data/lib/ext.rb +15 -19
- data/lib/less.rb +2 -2
- data/lib/less/command.rb +14 -15
- data/lib/less/engine.rb +3 -2
- data/lib/less/engine/grammar/common.tt +1 -1
- data/lib/less/engine/grammar/entity.tt +5 -5
- data/lib/less/engine/grammar/less.tt +107 -77
- data/lib/less/engine/nodes/element.rb +103 -24
- data/lib/less/engine/nodes/entity.rb +3 -3
- data/lib/less/engine/nodes/function.rb +11 -6
- data/lib/less/engine/nodes/literal.rb +8 -4
- data/lib/less/engine/nodes/property.rb +98 -38
- data/lib/less/engine/nodes/selector.rb +1 -1
- data/spec/css/css-3.css +14 -0
- data/spec/css/mixins-args.css +31 -0
- data/spec/css/variables.css +1 -0
- data/spec/css/whitespace.css +1 -0
- data/spec/engine_spec.rb +4 -3
- data/spec/less/css-3.less +30 -0
- data/spec/less/hidden.less +25 -0
- data/spec/less/import.less +1 -0
- data/spec/less/literal-css.less +11 -0
- data/spec/less/mixins-args.less +50 -0
- data/spec/less/variables.less +7 -1
- data/spec/less/whitespace.less +1 -0
- data/spec/spec_helper.rb +2 -2
- metadata +25 -94
- data/lib/vendor/treetop/.gitignore +0 -7
- data/lib/vendor/treetop/LICENSE +0 -19
- data/lib/vendor/treetop/README +0 -164
- data/lib/vendor/treetop/Rakefile +0 -19
- data/lib/vendor/treetop/benchmark/seqpar.gnuplot +0 -15
- data/lib/vendor/treetop/benchmark/seqpar.treetop +0 -16
- data/lib/vendor/treetop/benchmark/seqpar_benchmark.rb +0 -107
- data/lib/vendor/treetop/bin/tt +0 -28
- data/lib/vendor/treetop/lib/treetop.rb +0 -8
- data/lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -45
- data/lib/vendor/treetop/lib/treetop/compiler.rb +0 -6
- data/lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +0 -42
- data/lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +0 -17
- data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb +0 -3097
- data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +0 -408
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes.rb +0 -19
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -18
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +0 -24
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +0 -31
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +0 -28
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +0 -19
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -138
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -55
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +0 -45
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +0 -55
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +0 -68
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +0 -20
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
- data/lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +0 -113
- data/lib/vendor/treetop/lib/treetop/ruby_extensions.rb +0 -2
- data/lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb +0 -42
- data/lib/vendor/treetop/lib/treetop/runtime.rb +0 -5
- data/lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +0 -105
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +0 -4
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
- data/lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb +0 -72
- data/lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
- data/lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
- data/lib/vendor/treetop/lib/treetop/version.rb +0 -9
- data/lib/vendor/treetop/spec/compiler/and_predicate_spec.rb +0 -36
- data/lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb +0 -44
- data/lib/vendor/treetop/spec/compiler/character_class_spec.rb +0 -182
- data/lib/vendor/treetop/spec/compiler/choice_spec.rb +0 -80
- data/lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb +0 -28
- data/lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +0 -21
- data/lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +0 -84
- data/lib/vendor/treetop/spec/compiler/grammar_spec.rb +0 -41
- data/lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +0 -40
- data/lib/vendor/treetop/spec/compiler/not_predicate_spec.rb +0 -38
- data/lib/vendor/treetop/spec/compiler/one_or_more_spec.rb +0 -35
- data/lib/vendor/treetop/spec/compiler/optional_spec.rb +0 -37
- data/lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +0 -19
- data/lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb +0 -32
- data/lib/vendor/treetop/spec/compiler/sequence_spec.rb +0 -115
- data/lib/vendor/treetop/spec/compiler/terminal_spec.rb +0 -81
- data/lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +0 -37
- data/lib/vendor/treetop/spec/compiler/test_grammar.treetop +0 -7
- data/lib/vendor/treetop/spec/compiler/test_grammar.tt +0 -7
- data/lib/vendor/treetop/spec/compiler/test_grammar_do.treetop +0 -7
- data/lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb +0 -56
- data/lib/vendor/treetop/spec/composition/a.treetop +0 -11
- data/lib/vendor/treetop/spec/composition/b.treetop +0 -11
- data/lib/vendor/treetop/spec/composition/c.treetop +0 -10
- data/lib/vendor/treetop/spec/composition/d.treetop +0 -10
- data/lib/vendor/treetop/spec/composition/f.treetop +0 -17
- data/lib/vendor/treetop/spec/composition/grammar_composition_spec.rb +0 -40
- data/lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop +0 -15
- data/lib/vendor/treetop/spec/ruby_extensions/string_spec.rb +0 -32
- data/lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb +0 -101
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -164
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
- data/lib/vendor/treetop/spec/runtime/syntax_node_spec.rb +0 -53
- data/lib/vendor/treetop/spec/spec_helper.rb +0 -106
- data/lib/vendor/treetop/spec/spec_suite.rb +0 -4
- data/lib/vendor/treetop/treetop.gemspec +0 -17
|
@@ -57,20 +57,20 @@ module Less
|
|
|
57
57
|
# An anonymous node, for all the 'other' stuff
|
|
58
58
|
# which doesn't need any specific functionality.
|
|
59
59
|
#
|
|
60
|
-
class Anonymous <
|
|
60
|
+
class Anonymous < String
|
|
61
61
|
include Entity
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
#
|
|
65
65
|
# + * - /
|
|
66
66
|
#
|
|
67
|
-
class Operator <
|
|
67
|
+
class Operator < String
|
|
68
68
|
def to_ruby
|
|
69
69
|
self
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
class Paren <
|
|
73
|
+
class Paren < String
|
|
74
74
|
def to_ruby
|
|
75
75
|
self
|
|
76
76
|
end
|
|
@@ -48,17 +48,22 @@ module Less
|
|
|
48
48
|
#
|
|
49
49
|
# it calls functions from the Functions module
|
|
50
50
|
#
|
|
51
|
-
class Function <
|
|
51
|
+
class Function < String
|
|
52
52
|
include Entity
|
|
53
53
|
include Functions
|
|
54
54
|
|
|
55
|
-
def initialize name,
|
|
56
|
-
@args = args.
|
|
55
|
+
def initialize name, args
|
|
56
|
+
@args = if args.is_a? Array
|
|
57
|
+
args.map {|e| e.is_a?(Expression) ? e : Expression.new(e, self)}
|
|
58
|
+
else
|
|
59
|
+
[args]
|
|
60
|
+
end
|
|
61
|
+
|
|
57
62
|
super name
|
|
58
63
|
end
|
|
59
64
|
|
|
60
|
-
def to_css
|
|
61
|
-
self.evaluate.to_css
|
|
65
|
+
def to_css env = nil
|
|
66
|
+
self.evaluate(env).to_css *env
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
#
|
|
@@ -67,7 +72,7 @@ module Less
|
|
|
67
72
|
# If the function isn't found, we just print it out,
|
|
68
73
|
# this is the case for url(), for example,
|
|
69
74
|
#
|
|
70
|
-
def evaluate
|
|
75
|
+
def evaluate context = nil
|
|
71
76
|
if Functions.available.include? self.to_sym
|
|
72
77
|
send to_sym, *@args
|
|
73
78
|
else
|
|
@@ -17,7 +17,7 @@ module Less
|
|
|
17
17
|
|
|
18
18
|
def initialize r, g, b, a = 1.0
|
|
19
19
|
@r, @g, @b = [r, g, b].map do |c|
|
|
20
|
-
normalize(c.is_a?(
|
|
20
|
+
normalize(c.is_a?(String) ? c.to_i(16) : c)
|
|
21
21
|
end
|
|
22
22
|
@a = normalize(a, 1.0)
|
|
23
23
|
end
|
|
@@ -94,7 +94,11 @@ module Less
|
|
|
94
94
|
def to_s
|
|
95
95
|
"#{super}#@unit"
|
|
96
96
|
end
|
|
97
|
-
|
|
97
|
+
|
|
98
|
+
def dup
|
|
99
|
+
self
|
|
100
|
+
end
|
|
101
|
+
|
|
98
102
|
def to_ruby
|
|
99
103
|
self.to_f
|
|
100
104
|
end
|
|
@@ -111,7 +115,7 @@ module Less
|
|
|
111
115
|
#
|
|
112
116
|
# "hello world"
|
|
113
117
|
#
|
|
114
|
-
class
|
|
118
|
+
class Quoted < String
|
|
115
119
|
include Literal
|
|
116
120
|
|
|
117
121
|
attr_reader :quotes, :content
|
|
@@ -152,7 +156,7 @@ module Less
|
|
|
152
156
|
#
|
|
153
157
|
# ex: red, small, border-collapse
|
|
154
158
|
#
|
|
155
|
-
class Keyword <
|
|
159
|
+
class Keyword < String
|
|
156
160
|
include Entity
|
|
157
161
|
|
|
158
162
|
def to_css
|
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
module Less
|
|
2
2
|
module Node
|
|
3
|
-
class Property <
|
|
3
|
+
class Property < String
|
|
4
4
|
include Entity
|
|
5
5
|
|
|
6
6
|
attr_accessor :value
|
|
7
7
|
|
|
8
8
|
def initialize key, value = nil, parent = nil
|
|
9
9
|
super key, parent
|
|
10
|
-
|
|
11
10
|
value = if value.is_a? Array
|
|
12
|
-
value.each {|v| v.parent = self if v.respond_to? :parent }
|
|
11
|
+
value.each {|v| v.parent = self if v.respond_to? :parent }.
|
|
12
|
+
map {|v| v.is_a?(Expression) ? v : Expression.new(v, self) }
|
|
13
13
|
elsif value.nil?
|
|
14
14
|
[]
|
|
15
15
|
else
|
|
16
16
|
value
|
|
17
17
|
end
|
|
18
|
-
|
|
19
|
-
@value =
|
|
20
|
-
@
|
|
18
|
+
@value = value.is_a?(Expression) ? value : Expression.new(value, self)
|
|
19
|
+
@value.parent = self
|
|
20
|
+
@value.delimiter = ','
|
|
21
|
+
# puts "new property #{to_s}: #{value} => #{@value}, contains: #{@value[0].class}"
|
|
22
|
+
# puts
|
|
21
23
|
end
|
|
22
|
-
|
|
23
|
-
def
|
|
24
|
+
|
|
25
|
+
def parent= obj
|
|
26
|
+
@parent = obj
|
|
27
|
+
value.parent = self
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def copy
|
|
31
|
+
clone.tap {|c| c.value = value.copy }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def << token
|
|
24
35
|
token = Node::Anonymous.new(*token) unless token.is_a? Entity or token.respond_to? :to_ruby
|
|
25
36
|
token.parent = self if token.respond_to? :parent
|
|
26
37
|
@value << token
|
|
27
38
|
end
|
|
28
39
|
|
|
29
40
|
def empty?; !@value || @value.empty? end
|
|
30
|
-
def eval?; @eval end
|
|
31
41
|
|
|
32
42
|
def inspect
|
|
33
43
|
self + (empty?? "" : ": `#{value.map {|i| i.to_s } * ' | '}`")
|
|
@@ -49,13 +59,29 @@ module Less
|
|
|
49
59
|
parent.nearest node
|
|
50
60
|
end
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
def evaluate env = nil
|
|
63
|
+
# puts "evaluating property `#{to_s}`: #{value.inspect}"
|
|
64
|
+
if value.is_a?(Expression) #Value
|
|
65
|
+
# puts "value is a Value"
|
|
66
|
+
value.map {|e| e.evaluate(env) } #6
|
|
67
|
+
else
|
|
68
|
+
# puts "value is a #{value.class}"
|
|
69
|
+
[value.evaluate(env)]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
|
|
55
73
|
end
|
|
56
74
|
|
|
57
|
-
def to_css
|
|
58
|
-
"
|
|
75
|
+
def to_css env = nil
|
|
76
|
+
# puts "property.to_css `#{to_s}` env:#{env ? env.variables : "nil"}"
|
|
77
|
+
val = evaluate(env)
|
|
78
|
+
"#{self}: #{if val.respond_to? :to_css
|
|
79
|
+
val.to_css
|
|
80
|
+
else
|
|
81
|
+
# p val
|
|
82
|
+
# puts "#{val.class} #{val.first.class}"
|
|
83
|
+
val.map {|i| i.to_css }.join(", ")
|
|
84
|
+
end};"
|
|
59
85
|
end
|
|
60
86
|
end
|
|
61
87
|
|
|
@@ -75,11 +101,13 @@ module Less
|
|
|
75
101
|
"@#{super}"
|
|
76
102
|
end
|
|
77
103
|
|
|
78
|
-
def evaluate
|
|
104
|
+
def evaluate env = nil
|
|
79
105
|
if declaration
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
# puts "evaluating DEC"
|
|
107
|
+
value.evaluate #2
|
|
108
|
+
else
|
|
109
|
+
# puts "evaluating #{to_s} par: #{parent} env: #{env ? env.variables : "nil"}"
|
|
110
|
+
(env || self.parent).nearest(to_s).evaluate #3
|
|
83
111
|
end
|
|
84
112
|
end
|
|
85
113
|
|
|
@@ -87,20 +115,28 @@ module Less
|
|
|
87
115
|
evaluate.to_ruby
|
|
88
116
|
end
|
|
89
117
|
|
|
90
|
-
def to_css
|
|
91
|
-
evaluate
|
|
118
|
+
def to_css env = nil
|
|
119
|
+
val = evaluate env
|
|
120
|
+
if val.respond_to? :to_css
|
|
121
|
+
env ? val.to_css(env) : val.to_css
|
|
122
|
+
else
|
|
123
|
+
val.map {|i| env ? i.to_css(env) : i.to_css }.join ', '
|
|
124
|
+
end
|
|
92
125
|
end
|
|
93
126
|
end
|
|
94
|
-
|
|
127
|
+
|
|
95
128
|
class Expression < Array
|
|
96
|
-
|
|
129
|
+
attr_accessor :parent, :delimiter
|
|
97
130
|
|
|
98
|
-
def initialize ary, parent = nil
|
|
131
|
+
def initialize ary, parent = nil, delimiter = ' '
|
|
99
132
|
self.parent = parent
|
|
100
|
-
|
|
133
|
+
self.delimiter = delimiter
|
|
134
|
+
# puts "new expression #{ary} |#{delimiter}|"
|
|
135
|
+
super(ary.is_a?(Array) ? ary : [ary].flatten)
|
|
101
136
|
end
|
|
102
137
|
|
|
103
138
|
def expressions; select {|i| i.kind_of? Expression } end
|
|
139
|
+
def variables; select {|i| i.kind_of? Variable } end
|
|
104
140
|
def operators; select {|i| i.is_a? Operator } end
|
|
105
141
|
def entities; select {|i| i.kind_of? Entity } end
|
|
106
142
|
def literals; select {|i| i.kind_of? Literal } end
|
|
@@ -114,14 +150,23 @@ module Less
|
|
|
114
150
|
'[' + map {|i| i.inspect }.join(', ') + ']'
|
|
115
151
|
end
|
|
116
152
|
|
|
153
|
+
def delimiter= d
|
|
154
|
+
@delimiter = d.strip + ' '
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def flatten
|
|
158
|
+
self
|
|
159
|
+
end
|
|
160
|
+
|
|
117
161
|
def terminal?
|
|
118
|
-
expressions.empty?
|
|
162
|
+
expressions.empty? #&& variables.empty?
|
|
119
163
|
end
|
|
120
|
-
|
|
121
|
-
def to_css
|
|
164
|
+
|
|
165
|
+
def to_css env = nil
|
|
166
|
+
# puts "TOCSS, delim: |#{@delimiter}|"
|
|
122
167
|
map do |i|
|
|
123
|
-
i.respond_to?(:to_css) ? i.to_css : i.to_s
|
|
124
|
-
end *
|
|
168
|
+
i.respond_to?(:to_css) ? i.to_css(*env) : i.to_s
|
|
169
|
+
end * @delimiter
|
|
125
170
|
end
|
|
126
171
|
|
|
127
172
|
def to_ruby
|
|
@@ -134,27 +179,42 @@ module Less
|
|
|
134
179
|
# Evaluates the expression and instantiates a new Literal with the result
|
|
135
180
|
# ex: [#111, +, #111] will evaluate to a Color node, with value #222
|
|
136
181
|
#
|
|
137
|
-
def evaluate
|
|
182
|
+
def evaluate env = nil
|
|
183
|
+
# puts "expression #{self.inspect} env: #{env ? env.variables : "nil"}"
|
|
138
184
|
if size > 2 or !terminal?
|
|
185
|
+
# puts " SIZE > 2 or !terminal"
|
|
186
|
+
|
|
187
|
+
# puts "--- sub evaluation ---"
|
|
188
|
+
|
|
139
189
|
# Replace self with an evaluated sub-expression
|
|
140
|
-
|
|
190
|
+
evaled = self.class.new(map {|e| e.respond_to?(:evaluate) ? e.evaluate(env) : e }, parent, delimiter) #5
|
|
191
|
+
|
|
192
|
+
# puts "======================"
|
|
193
|
+
# puts "evaled => #{evaled.inspect}"
|
|
141
194
|
|
|
142
|
-
unit = literals.map do |node|
|
|
195
|
+
unit = evaled.literals.map do |node|
|
|
143
196
|
node.unit
|
|
144
197
|
end.compact.uniq.tap do |ary|
|
|
145
|
-
raise MixedUnitsError,
|
|
198
|
+
raise MixedUnitsError, evaled * ' ' if ary.size > 1 && !evaled.operators.empty?
|
|
146
199
|
end.join
|
|
147
200
|
|
|
148
|
-
entity = literals.find {|e| e.unit == unit } || entities.first
|
|
149
|
-
result = operators.empty??
|
|
150
|
-
|
|
201
|
+
entity = evaled.literals.find {|e| e.unit == unit } || evaled.literals.first || evaled.entities.first
|
|
202
|
+
result = evaled.operators.empty?? evaled : eval(evaled.to_ruby.join)
|
|
203
|
+
|
|
204
|
+
# puts "entity is a #{entity.class}"
|
|
205
|
+
# puts "delimiter is |#{@delimiter}|"
|
|
206
|
+
|
|
151
207
|
case result
|
|
152
208
|
when Entity then result
|
|
153
|
-
when Expression then result.one?? result.first : self.class.new(result)
|
|
209
|
+
when Expression then result.one?? result.first : self.class.new(result, parent, delimiter)
|
|
154
210
|
else entity.class.new(result, *(unit if entity.class == Node::Number))
|
|
155
211
|
end
|
|
156
212
|
elsif size == 1
|
|
157
|
-
first
|
|
213
|
+
if first.is_a? Variable
|
|
214
|
+
first.evaluate(env)
|
|
215
|
+
else
|
|
216
|
+
first
|
|
217
|
+
end
|
|
158
218
|
else
|
|
159
219
|
self
|
|
160
220
|
end
|
data/spec/css/css-3.css
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
.comma-delimited {
|
|
2
|
+
background: url(bg.jpg) no-repeat, url(bg.png) repeat-x top left, url(bg);
|
|
3
|
+
text-shadow: -1px -1px 1px red, 6px 5px 5px yellow;
|
|
4
|
+
-moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset, 0pt 4px 6px rgba(255, 255, 255, 0.4) inset;
|
|
5
|
+
}
|
|
6
|
+
@font-face {
|
|
7
|
+
font-family: Headline;
|
|
8
|
+
src: local(Futura-Medium), url(fonts.svg#MyGeometricModern) format("svg");
|
|
9
|
+
}
|
|
10
|
+
.other { -moz-transform: translate(0, 11em) rotate(-90deg); }
|
|
1
11
|
p:not([class*="lead"]) { color: black; }
|
|
12
|
+
input[type="text"].class#id[attr=32]:not(1) { color: white; }
|
|
13
|
+
div#id.class[a=1][b=2].class:not(1) { color: white; }
|
|
14
|
+
ul.comma > li:not(:only-child)::after { color: white; }
|
|
15
|
+
ol.comma > li:nth-last-child(2)::after { color: white; }
|
|
2
16
|
a[href^="http://"], a[href$="http://"] { color: black; }
|
|
3
17
|
p::before { color: black; }
|
data/spec/css/mixins-args.css
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.two-args {
|
|
2
|
+
color: blue;
|
|
3
|
+
width: 10px;
|
|
4
|
+
height: 99%;
|
|
5
|
+
}
|
|
6
|
+
.one-arg {
|
|
7
|
+
width: 15px;
|
|
8
|
+
height: 49%;
|
|
9
|
+
}
|
|
10
|
+
.no-parens {
|
|
11
|
+
width: 5px;
|
|
12
|
+
height: 49%;
|
|
13
|
+
}
|
|
14
|
+
.no-args {
|
|
15
|
+
width: 5px;
|
|
16
|
+
height: 49%;
|
|
17
|
+
}
|
|
18
|
+
.var-args {
|
|
19
|
+
width: 45;
|
|
20
|
+
height: 17%;
|
|
21
|
+
}
|
|
22
|
+
.multi-mix {
|
|
23
|
+
width: 10px;
|
|
24
|
+
height: 29%;
|
|
25
|
+
margin: 4;
|
|
26
|
+
padding: 5;
|
|
27
|
+
}
|
|
28
|
+
body {
|
|
29
|
+
padding: 30px;
|
|
30
|
+
color: #ff0000;
|
|
31
|
+
}
|
data/spec/css/variables.css
CHANGED
data/spec/css/whitespace.css
CHANGED
data/spec/engine_spec.rb
CHANGED
|
@@ -84,16 +84,17 @@ describe Less::Engine do
|
|
|
84
84
|
|
|
85
85
|
it "should handle custom functions" do
|
|
86
86
|
module Less::Functions
|
|
87
|
-
def color
|
|
87
|
+
def color args
|
|
88
|
+
arg = args.first
|
|
88
89
|
Less::Node::Color.new("99", "99", "99") if arg == "evil red"
|
|
89
90
|
end
|
|
90
91
|
|
|
91
92
|
def increment a
|
|
92
|
-
Less::Node::Number.new(a.to_i + 1)
|
|
93
|
+
Less::Node::Number.new(a.evaluate.to_i + 1)
|
|
93
94
|
end
|
|
94
95
|
|
|
95
96
|
def add a, b
|
|
96
|
-
Less::Node::Number.new(a + b)
|
|
97
|
+
Less::Node::Number.new(a.evaluate + b.evaluate)
|
|
97
98
|
end
|
|
98
99
|
end
|
|
99
100
|
lessify(:functions).should == css(:functions)
|
data/spec/less/css-3.less
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
.comma-delimited {
|
|
2
|
+
background: url(bg.jpg) no-repeat, url(bg.png) repeat-x top left, url(bg);
|
|
3
|
+
text-shadow: -1px -1px 1px red, 6px 5px 5px yellow;
|
|
4
|
+
-moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset,
|
|
5
|
+
0pt 4px 6px rgba(255, 255, 255, 0.4) inset;
|
|
6
|
+
}
|
|
7
|
+
@font-face {
|
|
8
|
+
font-family: Headline;
|
|
9
|
+
src: local(Futura-Medium),
|
|
10
|
+
url(fonts.svg#MyGeometricModern) format("svg");
|
|
11
|
+
}
|
|
12
|
+
.other {
|
|
13
|
+
-moz-transform: translate(0, 11em) rotate(-90deg);
|
|
14
|
+
}
|
|
1
15
|
p:not([class*="lead"]) {
|
|
2
16
|
color: black;
|
|
3
17
|
}
|
|
4
18
|
|
|
19
|
+
input[type="text"].class#id[attr=32]:not(1) {
|
|
20
|
+
color: white;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
div#id.class[a=1][b=2].class:not(1) {
|
|
24
|
+
color: white;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ul.comma > li:not(:only-child)::after {
|
|
28
|
+
color: white;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ol.comma > li:nth-last-child(2)::after {
|
|
32
|
+
color: white;
|
|
33
|
+
}
|
|
34
|
+
|
|
5
35
|
a[href^="http://"] {
|
|
6
36
|
color: black;
|
|
7
37
|
}
|