haml-edge 2.1.3 → 2.1.4

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 CHANGED
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.1.4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.1.4
@@ -35,6 +35,7 @@ module Sass::Tree
35
35
  end
36
36
 
37
37
  children.each do |kid|
38
+ next if kid.invisible?
38
39
  to_return << kid.to_s(tabs, real_name) << join_string
39
40
  end
40
41
 
@@ -20,11 +20,22 @@ module Sass::Tree
20
20
  end
21
21
 
22
22
  def to_s(tabs = 0, parent_name = nil)
23
- return if (@style == :compressed || silent?)
23
+ return if invisible?
24
24
 
25
25
  spaces = ' ' * (tabs - 1)
26
26
  spaces + "/* " + ([value] + lines.map {|l| l.text}).
27
27
  map{|l| l.sub(%r{ ?\*/ *$},'')}.join(@style == :compact ? ' ' : "\n#{spaces} * ") + " */"
28
28
  end
29
+
30
+ def invisible?
31
+ @style == :compressed || silent?
32
+ end
33
+
34
+ protected
35
+
36
+ def _perform(environment)
37
+ return [] if silent?
38
+ self
39
+ end
29
40
  end
30
41
  end
@@ -19,6 +19,7 @@ module Sass::Tree
19
19
  was_attr = false
20
20
  first = true
21
21
  children.each do |child|
22
+ next if child.invisible?
22
23
  if @style == :compact
23
24
  if child.is_a?(AttrNode)
24
25
  result << "#{child.to_s(first || was_attr ? 1 : tabs + 1)} "
@@ -27,14 +27,16 @@ module Sass
27
27
  self.class == other.class && other.children == children
28
28
  end
29
29
 
30
+ def invisible?; false; end
31
+
30
32
  def to_s
31
33
  result = String.new
32
34
  children.each do |child|
33
35
  if child.is_a? AttrNode
34
36
  raise Sass::SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line)
35
37
  else
38
+ next if child.invisible?
36
39
  child_str = child.to_s(1)
37
- next unless child_str && child_str.length > 0
38
40
  result << child_str + (@style == :compressed ? '' : "\n")
39
41
  end
40
42
  end
@@ -40,6 +40,7 @@ module Sass::Tree
40
40
  end.join(line_separator)
41
41
 
42
42
  children.each do |child|
43
+ next if child.invisible?
43
44
  if child.is_a? RuleNode
44
45
  sub_rules << child
45
46
  else
@@ -681,6 +681,50 @@ a
681
681
  SASS
682
682
  end
683
683
 
684
+ # Regression tests
685
+
686
+ def test_comment_beneath_attr
687
+ assert_equal(<<RESULT, render(<<SOURCE))
688
+ .box {
689
+ border-style: solid; }
690
+ RESULT
691
+ .box
692
+ :border
693
+ //:color black
694
+ :style solid
695
+ SOURCE
696
+
697
+ assert_equal(<<RESULT, render(<<SOURCE))
698
+ .box {
699
+ /* :color black */
700
+ border-style: solid; }
701
+ RESULT
702
+ .box
703
+ :border
704
+ /*:color black
705
+ :style solid
706
+ SOURCE
707
+
708
+ assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
709
+ .box{border-style:solid}
710
+ RESULT
711
+ .box
712
+ :border
713
+ /*:color black
714
+ :style solid
715
+ SOURCE
716
+ end
717
+
718
+ def test_compressed_comment_beneath_directive
719
+ assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
720
+ @foo{a:b}
721
+ RESULT
722
+ @foo
723
+ a: b
724
+ /*b: c
725
+ SOURCE
726
+ end
727
+
684
728
  private
685
729
 
686
730
  def render(sass, options = {})
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.1.3
4
+ version: 2.1.4
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-05-02 00:00:00 -04:00
13
+ date: 2009-05-10 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16