haml-edge 2.3.220 → 2.3.221
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/haml/exec.rb +7 -5
- data/lib/sass/files.rb +1 -0
- data/lib/sass/script/number.rb +8 -0
- data/lib/sass/tree/directive_node.rb +1 -1
- data/lib/sass/tree/mixin_def_node.rb +12 -0
- data/lib/sass/tree/node.rb +2 -0
- data/lib/sass/tree/prop_node.rb +2 -2
- data/lib/sass/tree/rule_node.rb +1 -1
- data/test/sass/conversion_test.rb +67 -0
- metadata +2 -2
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.221
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.221
|
data/lib/haml/exec.rb
CHANGED
@@ -58,8 +58,8 @@ module Haml
|
|
58
58
|
# SyntaxErrors have weird line reporting
|
59
59
|
# when there's trailing whitespace,
|
60
60
|
# which there is for Haml documents.
|
61
|
-
return exception.message.scan(/:(\d+)/).first.first if exception.is_a?(::SyntaxError)
|
62
|
-
exception.backtrace[0].scan(/:(\d+)/).first.first
|
61
|
+
return (exception.message.scan(/:(\d+)/).first || ["??"]).first if exception.is_a?(::SyntaxError)
|
62
|
+
(exception.backtrace[0].scan(/:(\d+)/).first || ["??"]).first
|
63
63
|
end
|
64
64
|
|
65
65
|
# Tells optparse how to parse the arguments
|
@@ -371,8 +371,9 @@ MSG
|
|
371
371
|
end
|
372
372
|
|
373
373
|
dirs, files = @args.map {|name| name.split(':', 2)}.
|
374
|
-
map {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}.
|
375
374
|
partition {|i, _| File.directory? i}
|
375
|
+
files.map! {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}
|
376
|
+
dirs.map! {|from, to| [from, to || from]}
|
376
377
|
::Sass::Plugin.options[:template_location] = dirs
|
377
378
|
|
378
379
|
::Sass::Plugin.on_updating_stylesheet do |_, css|
|
@@ -648,7 +649,7 @@ END
|
|
648
649
|
|
649
650
|
super
|
650
651
|
input = @options[:input]
|
651
|
-
raise "Error: '#{input}' is a directory (did you mean to use --recursive?)" if File.directory?(input)
|
652
|
+
raise "Error: '#{input.path}' is a directory (did you mean to use --recursive?)" if File.directory?(input)
|
652
653
|
output = @options[:output]
|
653
654
|
output = input if @options[:in_place]
|
654
655
|
process_file(input, output)
|
@@ -750,7 +751,8 @@ END
|
|
750
751
|
output.write(out)
|
751
752
|
rescue ::Sass::SyntaxError => e
|
752
753
|
raise e if @options[:trace]
|
753
|
-
|
754
|
+
file = " of #{e.sass_filename}" if e.sass_filename
|
755
|
+
raise "Error on line #{e.sass_line}#{file}: #{e.message}\n Use --trace for backtrace"
|
754
756
|
end
|
755
757
|
end
|
756
758
|
end
|
data/lib/sass/files.rb
CHANGED
@@ -77,6 +77,7 @@ module Sass
|
|
77
77
|
end
|
78
78
|
|
79
79
|
new_filename = nil
|
80
|
+
load_paths = load_paths.uniq
|
80
81
|
load_paths.each do |load_path|
|
81
82
|
new_filename ||= find_full_path("#{filename}.sass", load_path) unless was_scss
|
82
83
|
new_filename ||= find_full_path("#{filename}.scss", load_path) unless was_sass
|
data/lib/sass/script/number.rb
CHANGED
@@ -25,6 +25,14 @@ module Sass::Script
|
|
25
25
|
# @return [Array<String>]
|
26
26
|
attr_reader :denominator_units
|
27
27
|
|
28
|
+
# The original representation of this number.
|
29
|
+
# For example, although the result of `1px/2px` is `0.5`,
|
30
|
+
# the value of `#original` is `"1px/2px"`.
|
31
|
+
#
|
32
|
+
# This is only non-nil when the original value should be used as the CSS value,
|
33
|
+
# as in `font: 1px/2px`.
|
34
|
+
#
|
35
|
+
# @return [Boolean, nil]
|
28
36
|
attr_accessor :original
|
29
37
|
|
30
38
|
# The precision with which numbers will be printed to CSS files.
|
@@ -25,7 +25,7 @@ module Sass::Tree
|
|
25
25
|
# @see Node#to_src
|
26
26
|
def to_src(tabs, opts, fmt)
|
27
27
|
res = "#{' ' * tabs}#{value}"
|
28
|
-
return res + "#{semi fmt}\n"
|
28
|
+
return res + "#{semi fmt}\n" unless has_children
|
29
29
|
res + children_to_src(tabs, opts, fmt) + "\n"
|
30
30
|
end
|
31
31
|
|
@@ -43,6 +43,18 @@ module Sass
|
|
43
43
|
environment.set_mixin(@name, Sass::Mixin.new(@name, @args, environment, children))
|
44
44
|
[]
|
45
45
|
end
|
46
|
+
|
47
|
+
# Returns an error message if the given child node is invalid,
|
48
|
+
# and false otherwise.
|
49
|
+
#
|
50
|
+
# {ExtendNode}s are valid within {MixinDefNode}s.
|
51
|
+
#
|
52
|
+
# @param child [Tree::Node] A potential child node.
|
53
|
+
# @return [Boolean, String] Whether or not the child node is valid,
|
54
|
+
# as well as the error message to display if it is invalid
|
55
|
+
def invalid_child?(child)
|
56
|
+
super unless child.is_a?(ExtendNode)
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
48
60
|
end
|
data/lib/sass/tree/node.rb
CHANGED
@@ -402,6 +402,8 @@ module Sass
|
|
402
402
|
# @param fmt [Symbol] `:sass` or `:scss`
|
403
403
|
# @return [String] The Sass or SCSS code corresponding to the children
|
404
404
|
def children_to_src(tabs, opts, fmt)
|
405
|
+
return fmt == :sass ? "\n" : " {}\n" if children.empty?
|
406
|
+
|
405
407
|
(fmt == :sass ? "\n" : " {\n") +
|
406
408
|
children.map {|c| c.send("to_#{fmt}", tabs + 1, opts)}.join.rstrip +
|
407
409
|
(fmt == :sass ? "\n" : " }\n")
|
data/lib/sass/tree/prop_node.rb
CHANGED
@@ -179,7 +179,6 @@ module Sass::Tree
|
|
179
179
|
class << self
|
180
180
|
# @private
|
181
181
|
def val_to_sass(value, opts)
|
182
|
-
return value.to_sass(opts) unless value.context == :equals
|
183
182
|
val_to_sass_comma(value, opts).to_sass(opts)
|
184
183
|
end
|
185
184
|
|
@@ -208,7 +207,8 @@ module Sass::Tree
|
|
208
207
|
def val_to_sass_div(node, opts)
|
209
208
|
unless node.is_a?(Sass::Script::Operation) && node.operator == :div &&
|
210
209
|
node.operand1.is_a?(Sass::Script::Number) &&
|
211
|
-
node.operand2.is_a?(Sass::Script::Number)
|
210
|
+
node.operand2.is_a?(Sass::Script::Number) &&
|
211
|
+
(node.context == :equals || !node.operand1.original || !node.operand2.original)
|
212
212
|
return node
|
213
213
|
end
|
214
214
|
|
data/lib/sass/tree/rule_node.rb
CHANGED
@@ -228,7 +228,7 @@ module Sass::Tree
|
|
228
228
|
#
|
229
229
|
# {ExtendNode}s are valid within {RuleNode}s.
|
230
230
|
#
|
231
|
-
# @param child [Tree::Node] A potential child
|
231
|
+
# @param child [Tree::Node] A potential child node.
|
232
232
|
# @return [Boolean, String] Whether or not the child node is valid,
|
233
233
|
# as well as the error message to display if it is invalid
|
234
234
|
def invalid_child?(child)
|
@@ -23,6 +23,19 @@ foo bar {
|
|
23
23
|
SCSS
|
24
24
|
end
|
25
25
|
|
26
|
+
def test_empty_selector
|
27
|
+
assert_renders "foo bar", "foo bar {}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_empty_directive
|
31
|
+
assert_scss_to_sass "@media screen", "@media screen {}"
|
32
|
+
assert_scss_to_scss "@media screen {}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_empty_control_directive
|
36
|
+
assert_renders "@if false", "@if false {}"
|
37
|
+
end
|
38
|
+
|
26
39
|
def test_nesting
|
27
40
|
assert_renders <<SASS, <<SCSS
|
28
41
|
foo bar
|
@@ -875,6 +888,60 @@ SCSS
|
|
875
888
|
assert_sass_to_scss '$var: 12px $bar baz !default;', '$var ||= 12px $bar "baz"'
|
876
889
|
end
|
877
890
|
|
891
|
+
def test_division_asserted_with_parens
|
892
|
+
assert_renders <<SASS, <<SCSS
|
893
|
+
foo
|
894
|
+
a: (1px / 2px)
|
895
|
+
SASS
|
896
|
+
foo {
|
897
|
+
a: (1px / 2px); }
|
898
|
+
SCSS
|
899
|
+
end
|
900
|
+
|
901
|
+
def test_division_not_asserted_when_unnecessary
|
902
|
+
assert_renders <<SASS, <<SCSS
|
903
|
+
$var: 1px / 2px
|
904
|
+
|
905
|
+
foo
|
906
|
+
a: $var
|
907
|
+
SASS
|
908
|
+
$var: 1px / 2px;
|
909
|
+
|
910
|
+
foo {
|
911
|
+
a: $var; }
|
912
|
+
SCSS
|
913
|
+
|
914
|
+
assert_renders <<SASS, <<SCSS
|
915
|
+
$var: 1px
|
916
|
+
|
917
|
+
foo
|
918
|
+
a: $var / 2px
|
919
|
+
SASS
|
920
|
+
$var: 1px;
|
921
|
+
|
922
|
+
foo {
|
923
|
+
a: $var / 2px; }
|
924
|
+
SCSS
|
925
|
+
|
926
|
+
assert_renders <<SASS, <<SCSS
|
927
|
+
foo
|
928
|
+
a: 1 + 1px / 2px
|
929
|
+
SASS
|
930
|
+
foo {
|
931
|
+
a: 1 + 1px / 2px; }
|
932
|
+
SCSS
|
933
|
+
end
|
934
|
+
|
935
|
+
def test_literal_slash
|
936
|
+
assert_renders <<SASS, <<SCSS
|
937
|
+
foo
|
938
|
+
a: 1px / 2px
|
939
|
+
SASS
|
940
|
+
foo {
|
941
|
+
a: 1px / 2px; }
|
942
|
+
SCSS
|
943
|
+
end
|
944
|
+
|
878
945
|
# Hacks
|
879
946
|
|
880
947
|
def test_declaration_hacks
|
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.221
|
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: 2010-04-
|
13
|
+
date: 2010-04-27 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|