jwhitmire-haml 2.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/README.rdoc +332 -0
  2. data/bin/css2sass +7 -0
  3. data/bin/haml +9 -0
  4. data/bin/html2haml +7 -0
  5. data/bin/sass +8 -0
  6. data/lib/haml/buffer.rb +255 -0
  7. data/lib/haml/engine.rb +268 -0
  8. data/lib/haml/error.rb +22 -0
  9. data/lib/haml/exec.rb +395 -0
  10. data/lib/haml/filters.rb +276 -0
  11. data/lib/haml/helpers/action_view_extensions.rb +45 -0
  12. data/lib/haml/helpers/action_view_mods.rb +181 -0
  13. data/lib/haml/helpers.rb +468 -0
  14. data/lib/haml/html.rb +218 -0
  15. data/lib/haml/precompiler.rb +889 -0
  16. data/lib/haml/shared.rb +45 -0
  17. data/lib/haml/template/patch.rb +58 -0
  18. data/lib/haml/template/plugin.rb +72 -0
  19. data/lib/haml/template.rb +51 -0
  20. data/lib/haml/util.rb +77 -0
  21. data/lib/haml/version.rb +47 -0
  22. data/lib/haml.rb +1042 -0
  23. data/lib/sass/css.rb +388 -0
  24. data/lib/sass/engine.rb +499 -0
  25. data/lib/sass/environment.rb +33 -0
  26. data/lib/sass/error.rb +35 -0
  27. data/lib/sass/plugin/merb.rb +56 -0
  28. data/lib/sass/plugin/rails.rb +24 -0
  29. data/lib/sass/plugin.rb +203 -0
  30. data/lib/sass/repl.rb +51 -0
  31. data/lib/sass/script/bool.rb +13 -0
  32. data/lib/sass/script/color.rb +97 -0
  33. data/lib/sass/script/funcall.rb +28 -0
  34. data/lib/sass/script/functions.rb +122 -0
  35. data/lib/sass/script/lexer.rb +152 -0
  36. data/lib/sass/script/literal.rb +60 -0
  37. data/lib/sass/script/number.rb +231 -0
  38. data/lib/sass/script/operation.rb +30 -0
  39. data/lib/sass/script/parser.rb +142 -0
  40. data/lib/sass/script/string.rb +42 -0
  41. data/lib/sass/script/unary_operation.rb +21 -0
  42. data/lib/sass/script/variable.rb +20 -0
  43. data/lib/sass/script.rb +38 -0
  44. data/lib/sass/tree/attr_node.rb +64 -0
  45. data/lib/sass/tree/comment_node.rb +34 -0
  46. data/lib/sass/tree/debug_node.rb +22 -0
  47. data/lib/sass/tree/directive_node.rb +50 -0
  48. data/lib/sass/tree/file_node.rb +27 -0
  49. data/lib/sass/tree/for_node.rb +29 -0
  50. data/lib/sass/tree/if_node.rb +27 -0
  51. data/lib/sass/tree/mixin_def_node.rb +18 -0
  52. data/lib/sass/tree/mixin_node.rb +34 -0
  53. data/lib/sass/tree/node.rb +99 -0
  54. data/lib/sass/tree/rule_node.rb +120 -0
  55. data/lib/sass/tree/variable_node.rb +24 -0
  56. data/lib/sass/tree/while_node.rb +20 -0
  57. data/lib/sass.rb +1062 -0
  58. data/test/benchmark.rb +99 -0
  59. data/test/haml/engine_test.rb +734 -0
  60. data/test/haml/helper_test.rb +224 -0
  61. data/test/haml/html2haml_test.rb +92 -0
  62. data/test/haml/markaby/standard.mab +52 -0
  63. data/test/haml/mocks/article.rb +6 -0
  64. data/test/haml/results/content_for_layout.xhtml +15 -0
  65. data/test/haml/results/eval_suppressed.xhtml +9 -0
  66. data/test/haml/results/filters.xhtml +62 -0
  67. data/test/haml/results/helpers.xhtml +93 -0
  68. data/test/haml/results/helpful.xhtml +10 -0
  69. data/test/haml/results/just_stuff.xhtml +68 -0
  70. data/test/haml/results/list.xhtml +12 -0
  71. data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  72. data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  73. data/test/haml/results/original_engine.xhtml +20 -0
  74. data/test/haml/results/partial_layout.xhtml +5 -0
  75. data/test/haml/results/partials.xhtml +21 -0
  76. data/test/haml/results/render_layout.xhtml +3 -0
  77. data/test/haml/results/silent_script.xhtml +74 -0
  78. data/test/haml/results/standard.xhtml +42 -0
  79. data/test/haml/results/tag_parsing.xhtml +23 -0
  80. data/test/haml/results/very_basic.xhtml +5 -0
  81. data/test/haml/results/whitespace_handling.xhtml +89 -0
  82. data/test/haml/rhtml/_av_partial_1.rhtml +12 -0
  83. data/test/haml/rhtml/_av_partial_2.rhtml +8 -0
  84. data/test/haml/rhtml/action_view.rhtml +62 -0
  85. data/test/haml/rhtml/standard.rhtml +54 -0
  86. data/test/haml/template_test.rb +204 -0
  87. data/test/haml/templates/_av_partial_1.haml +9 -0
  88. data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
  89. data/test/haml/templates/_av_partial_2.haml +5 -0
  90. data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
  91. data/test/haml/templates/_layout.erb +3 -0
  92. data/test/haml/templates/_layout_for_partial.haml +3 -0
  93. data/test/haml/templates/_partial.haml +8 -0
  94. data/test/haml/templates/_text_area.haml +3 -0
  95. data/test/haml/templates/action_view.haml +47 -0
  96. data/test/haml/templates/action_view_ugly.haml +47 -0
  97. data/test/haml/templates/breakage.haml +8 -0
  98. data/test/haml/templates/content_for_layout.haml +10 -0
  99. data/test/haml/templates/eval_suppressed.haml +11 -0
  100. data/test/haml/templates/filters.haml +66 -0
  101. data/test/haml/templates/helpers.haml +95 -0
  102. data/test/haml/templates/helpful.haml +11 -0
  103. data/test/haml/templates/just_stuff.haml +83 -0
  104. data/test/haml/templates/list.haml +12 -0
  105. data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  106. data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  107. data/test/haml/templates/original_engine.haml +17 -0
  108. data/test/haml/templates/partial_layout.haml +3 -0
  109. data/test/haml/templates/partialize.haml +1 -0
  110. data/test/haml/templates/partials.haml +12 -0
  111. data/test/haml/templates/render_layout.haml +2 -0
  112. data/test/haml/templates/silent_script.haml +40 -0
  113. data/test/haml/templates/standard.haml +42 -0
  114. data/test/haml/templates/standard_ugly.haml +1 -0
  115. data/test/haml/templates/tag_parsing.haml +21 -0
  116. data/test/haml/templates/very_basic.haml +4 -0
  117. data/test/haml/templates/whitespace_handling.haml +87 -0
  118. data/test/linked_rails.rb +12 -0
  119. data/test/sass/css2sass_test.rb +193 -0
  120. data/test/sass/engine_test.rb +786 -0
  121. data/test/sass/functions_test.rb +96 -0
  122. data/test/sass/more_results/more1.css +9 -0
  123. data/test/sass/more_results/more1_with_line_comments.css +26 -0
  124. data/test/sass/more_results/more_import.css +29 -0
  125. data/test/sass/more_templates/_more_partial.sass +2 -0
  126. data/test/sass/more_templates/more1.sass +23 -0
  127. data/test/sass/more_templates/more_import.sass +11 -0
  128. data/test/sass/plugin_test.rb +208 -0
  129. data/test/sass/results/alt.css +4 -0
  130. data/test/sass/results/basic.css +9 -0
  131. data/test/sass/results/compact.css +5 -0
  132. data/test/sass/results/complex.css +87 -0
  133. data/test/sass/results/compressed.css +1 -0
  134. data/test/sass/results/expanded.css +19 -0
  135. data/test/sass/results/import.css +29 -0
  136. data/test/sass/results/line_numbers.css +49 -0
  137. data/test/sass/results/mixins.css +95 -0
  138. data/test/sass/results/multiline.css +24 -0
  139. data/test/sass/results/nested.css +22 -0
  140. data/test/sass/results/parent_ref.css +13 -0
  141. data/test/sass/results/script.css +16 -0
  142. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  143. data/test/sass/results/subdir/subdir.css +3 -0
  144. data/test/sass/results/units.css +11 -0
  145. data/test/sass/script_test.rb +153 -0
  146. data/test/sass/templates/_partial.sass +2 -0
  147. data/test/sass/templates/alt.sass +16 -0
  148. data/test/sass/templates/basic.sass +23 -0
  149. data/test/sass/templates/bork.sass +2 -0
  150. data/test/sass/templates/bork2.sass +2 -0
  151. data/test/sass/templates/compact.sass +17 -0
  152. data/test/sass/templates/complex.sass +309 -0
  153. data/test/sass/templates/compressed.sass +15 -0
  154. data/test/sass/templates/expanded.sass +17 -0
  155. data/test/sass/templates/import.sass +11 -0
  156. data/test/sass/templates/importee.sass +19 -0
  157. data/test/sass/templates/line_numbers.sass +13 -0
  158. data/test/sass/templates/mixins.sass +76 -0
  159. data/test/sass/templates/multiline.sass +20 -0
  160. data/test/sass/templates/nested.sass +25 -0
  161. data/test/sass/templates/parent_ref.sass +25 -0
  162. data/test/sass/templates/script.sass +101 -0
  163. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  164. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  165. data/test/sass/templates/subdir/subdir.sass +6 -0
  166. data/test/sass/templates/units.sass +11 -0
  167. data/test/test_helper.rb +21 -0
  168. metadata +245 -0
@@ -0,0 +1,22 @@
1
+ module Sass
2
+ module Tree
3
+ class DebugNode < Node
4
+ def initialize(expr, options)
5
+ @expr = expr
6
+ super(options)
7
+ end
8
+
9
+ protected
10
+
11
+ def _perform(environment)
12
+ res = @expr.perform(environment)
13
+ if filename
14
+ STDERR.puts "#{filename}:#{line} DEBUG: #{res}"
15
+ else
16
+ STDERR.puts "Line #{line} DEBUG: #{res}"
17
+ end
18
+ []
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,50 @@
1
+ module Sass::Tree
2
+ class DirectiveNode < Node
3
+ attr_accessor :value
4
+
5
+ def initialize(value, options)
6
+ @value = value
7
+ super(options)
8
+ end
9
+
10
+ def to_s(tabs)
11
+ if children.empty?
12
+ value + ";"
13
+ else
14
+ result = if @style == :compressed
15
+ "#{value}{"
16
+ else
17
+ "#{' ' * (tabs - 1)}#{value} {" + (@style == :compact ? ' ' : "\n")
18
+ end
19
+ was_attr = false
20
+ first = true
21
+ children.each do |child|
22
+ if @style == :compact
23
+ if child.is_a?(AttrNode)
24
+ result << "#{child.to_s(first || was_attr ? 1 : tabs + 1)} "
25
+ else
26
+ if was_attr
27
+ result[-1] = "\n"
28
+ end
29
+ rendered = child.to_s(tabs + 1)
30
+ rendered.lstrip! if first
31
+ result << rendered
32
+ end
33
+ was_attr = child.is_a?(AttrNode)
34
+ first = false
35
+ elsif @style == :compressed
36
+ result << (was_attr ? ";#{child.to_s(1)}" : child.to_s(1))
37
+ was_attr = child.is_a?(AttrNode)
38
+ else
39
+ result << child.to_s(tabs + 1) + "\n"
40
+ end
41
+ end
42
+ result.rstrip + if @style == :compressed
43
+ "}"
44
+ else
45
+ (@style == :expanded ? "\n" : " ") + "}\n"
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,27 @@
1
+ module Sass
2
+ module Tree
3
+ class FileNode < Node
4
+ def initialize(filename, children, options)
5
+ @filename = filename
6
+ super(options)
7
+ self.children = children
8
+ end
9
+
10
+ def to_s(*args)
11
+ super()
12
+ rescue Sass::SyntaxError => e
13
+ e.add_backtrace_entry(@filename)
14
+ raise e
15
+ end
16
+
17
+ protected
18
+
19
+ def perform!(environment)
20
+ self.children = perform_children(environment)
21
+ rescue Sass::SyntaxError => e
22
+ e.add_backtrace_entry(@filename)
23
+ raise e
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ require 'sass/tree/node'
2
+
3
+ module Sass::Tree
4
+ class ForNode < Node
5
+ def initialize(var, from, to, exclusive, options)
6
+ @var = var
7
+ @from = from
8
+ @to = to
9
+ @exclusive = exclusive
10
+ super(options)
11
+ end
12
+
13
+ protected
14
+
15
+ def _perform(environment)
16
+ from = @from.perform(environment).to_i
17
+ to = @to.perform(environment).to_i
18
+ range = Range.new(from, to, @exclusive)
19
+
20
+ children = []
21
+ range.each do |i|
22
+ environment = Sass::Environment.new(environment)
23
+ environment.set_local_var(@var, Sass::Script::Number.new(i))
24
+ children += perform_children(environment)
25
+ end
26
+ children
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ require 'sass/tree/node'
2
+
3
+ module Sass::Tree
4
+ class IfNode < Node
5
+ attr_accessor :else
6
+
7
+ def initialize(expr, options)
8
+ @expr = expr
9
+ @last_else = self
10
+ super(options)
11
+ end
12
+
13
+ def add_else(node)
14
+ @last_else.else = node
15
+ @last_else = node
16
+ end
17
+
18
+ protected
19
+
20
+ def _perform(environment)
21
+ environment = Sass::Environment.new(environment)
22
+ return perform_children(environment) if @expr.nil? || @expr.perform(environment).to_bool
23
+ return @else.perform(environment) if @else
24
+ []
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,18 @@
1
+ module Sass
2
+ module Tree
3
+ class MixinDefNode < Node
4
+ def initialize(name, args, options)
5
+ @name = name
6
+ @args = args
7
+ super(options)
8
+ end
9
+
10
+ private
11
+
12
+ def _perform(environment)
13
+ environment.set_mixin(@name, Sass::Mixin.new(@name, @args, environment, children))
14
+ []
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,34 @@
1
+ require 'sass/tree/node'
2
+
3
+ module Sass::Tree
4
+ class MixinNode < Node
5
+ def initialize(name, args, options)
6
+ @name = name
7
+ @args = args
8
+ super(options)
9
+ end
10
+
11
+ protected
12
+
13
+ def _perform(environment)
14
+ raise Sass::SyntaxError.new("Undefined mixin '#{@name}'.", @line) unless mixin = environment.mixin(@name)
15
+
16
+ raise Sass::SyntaxError.new(<<END.gsub("\n", "")) if mixin.args.size < @args.size
17
+ Mixin #{@name} takes #{mixin.args.size} argument#{'s' if mixin.args.size != 1}
18
+ but #{@args.size} #{@args.size == 1 ? 'was' : 'were'} passed.
19
+ END
20
+
21
+ environment = mixin.args.zip(@args).inject(Sass::Environment.new(mixin.environment)) do |env, (arg, value)|
22
+ env.set_local_var(arg[:name],
23
+ if value
24
+ value.perform(environment)
25
+ elsif arg[:default_value]
26
+ arg[:default_value].perform(env)
27
+ end)
28
+ raise Sass::SyntaxError.new("Mixin #{@name} is missing parameter !#{arg[:name]}.") unless env.var(arg[:name])
29
+ env
30
+ end
31
+ mixin.tree.map {|c| c.perform(environment)}.flatten
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,99 @@
1
+ module Sass
2
+ module Tree
3
+ class Node
4
+ attr_accessor :children
5
+ attr_accessor :line
6
+ attr_accessor :filename
7
+
8
+ def initialize(options)
9
+ @options = options
10
+ @style = options[:style]
11
+ @children = []
12
+ end
13
+
14
+ def <<(child)
15
+ if msg = invalid_child?(child)
16
+ raise Sass::SyntaxError.new(msg, child.line)
17
+ end
18
+ @children << child
19
+ end
20
+
21
+ # We need this because Node duck types as an Array in engine.rb
22
+ def last
23
+ children.last
24
+ end
25
+
26
+ def ==(other)
27
+ self.class == other.class && other.children == children
28
+ end
29
+
30
+ def to_s
31
+ result = String.new
32
+ children.each do |child|
33
+ if child.is_a? AttrNode
34
+ raise Sass::SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line)
35
+ else
36
+ child_str = child.to_s(1)
37
+ next unless child_str && child_str.length > 0
38
+ result << child_str + (@style == :compressed ? '' : "\n")
39
+ end
40
+ end
41
+ @style == :compressed ? result+"\n" : result[0...-1]
42
+ end
43
+
44
+ def perform(environment)
45
+ _perform(environment)
46
+ rescue Sass::SyntaxError => e
47
+ e.sass_line ||= line
48
+ raise e
49
+ end
50
+
51
+ protected
52
+
53
+ def _perform(environment)
54
+ node = dup
55
+ node.perform!(environment)
56
+ node
57
+ end
58
+
59
+ def perform!(environment)
60
+ self.children = perform_children(Environment.new(environment))
61
+ end
62
+
63
+ def perform_children(environment)
64
+ children.map {|c| c.perform(environment)}.flatten
65
+ end
66
+
67
+ def interpolate(text, environment)
68
+ res = ''
69
+ rest = Haml::Shared.handle_interpolation text do |scan|
70
+ escapes = scan[2].size
71
+ res << scan.matched[0...-2 - escapes]
72
+ if escapes % 2 == 1
73
+ res << "\\" * (escapes - 1) << '#{'
74
+ else
75
+ res << "\\" * [0, escapes - 1].max
76
+ res << Script::Parser.new(scan, line, scan.pos - scan.matchedsize, filename).
77
+ parse_interpolated.perform(environment).to_s
78
+ end
79
+ end
80
+ res + rest
81
+ end
82
+
83
+ def balance(*args)
84
+ res = Haml::Shared.balance(*args)
85
+ return res if res
86
+ raise Sass::SyntaxError.new("Unbalanced brackets.", line)
87
+ end
88
+
89
+ private
90
+
91
+ # This method should be overridden by subclasses to return an error message
92
+ # if the given child node is invalid,
93
+ # and false or nil otherwise.
94
+ def invalid_child?(child)
95
+ false
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,120 @@
1
+ module Sass::Tree
2
+ class RuleNode < Node
3
+ # The character used to include the parent selector
4
+ PARENT = '&'
5
+
6
+ attr_accessor :rule
7
+
8
+ def initialize(rule, options)
9
+ @rule = rule
10
+ super(options)
11
+ end
12
+
13
+ def ==(other)
14
+ self.class == other.class && rules == other.rules && super
15
+ end
16
+
17
+ def rules
18
+ Array(rule)
19
+ end
20
+
21
+ def add_rules(node)
22
+ self.rule = rules
23
+ self.rule += node.rules
24
+ end
25
+
26
+ def continued?
27
+ rule[-1] == ?,
28
+ end
29
+
30
+ def to_s(tabs, super_rules = nil)
31
+ attributes = []
32
+ sub_rules = []
33
+
34
+ rule_split = /\s*,\s*/
35
+ rule_separator = @style == :compressed ? ',' : ', '
36
+ line_separator = [:nested, :expanded].include?(@style) ? ",\n" : rule_separator
37
+ rule_indent = ' ' * (tabs - 1)
38
+ total_rule = if super_rules
39
+ super_rules.split(",\n").map do |super_line|
40
+ super_line.strip.split(rule_split).map do |super_rule|
41
+ self.rules.map do |line|
42
+ rule_indent + line.gsub(/,$/, '').split(rule_split).map do |rule|
43
+ if rule.include?(PARENT)
44
+ rule.gsub(PARENT, super_rule)
45
+ else
46
+ "#{super_rule} #{rule}"
47
+ end
48
+ end.join(rule_separator)
49
+ end.join(line_separator)
50
+ end.join(rule_separator)
51
+ end.join(line_separator)
52
+ elsif self.rules.any? { |r| r.include?(PARENT) }
53
+ raise Sass::SyntaxError.new("Base-level rules cannot contain the parent-selector-referencing character '#{PARENT}'.", line)
54
+ else
55
+ per_rule_indent, total_indent = [:nested, :expanded].include?(@style) ? [rule_indent, ''] : ['', rule_indent]
56
+ total_indent + self.rules.map do |r|
57
+ per_rule_indent + r.gsub(/,$/, '').gsub(rule_split, rule_separator).rstrip
58
+ end.join(line_separator)
59
+ end
60
+
61
+ children.each do |child|
62
+ if child.is_a? RuleNode
63
+ sub_rules << child
64
+ else
65
+ attributes << child
66
+ end
67
+ end
68
+
69
+ to_return = ''
70
+ if !attributes.empty?
71
+ old_spaces = ' ' * (tabs - 1)
72
+ spaces = ' ' * tabs
73
+ if @options[:line_comments] && @style != :compressed
74
+ to_return << "#{old_spaces}/* line #{line}"
75
+
76
+ if filename
77
+ relative_filename = if @options[:css_filename]
78
+ begin
79
+ Pathname.new(filename).relative_path_from(
80
+ Pathname.new(File.dirname(@options[:css_filename]))).to_s
81
+ rescue ArgumentError
82
+ nil
83
+ end
84
+ end
85
+ relative_filename ||= filename
86
+ to_return << ", #{relative_filename}"
87
+ end
88
+
89
+ to_return << " */\n"
90
+ end
91
+
92
+ if @style == :compact
93
+ attributes = attributes.map { |a| a.to_s(1) }.select{|a| a && a.length > 0}.join(' ')
94
+ to_return << "#{total_rule} { #{attributes} }\n"
95
+ elsif @style == :compressed
96
+ attributes = attributes.map { |a| a.to_s(1) }.select{|a| a && a.length > 0}.join(';')
97
+ to_return << "#{total_rule}{#{attributes}}"
98
+ else
99
+ attributes = attributes.map { |a| a.to_s(tabs + 1) }.select{|a| a && a.length > 0}.join("\n")
100
+ end_attrs = (@style == :expanded ? "\n" + old_spaces : ' ')
101
+ to_return << "#{total_rule} {\n#{attributes}#{end_attrs}}\n"
102
+ end
103
+ end
104
+
105
+ tabs += 1 unless attributes.empty? || @style != :nested
106
+ sub_rules.each do |sub|
107
+ to_return << sub.to_s(tabs, total_rule)
108
+ end
109
+
110
+ to_return
111
+ end
112
+
113
+ protected
114
+
115
+ def perform!(environment)
116
+ self.rule = rules.map {|r| interpolate(r, environment)}
117
+ super
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,24 @@
1
+ module Sass
2
+ module Tree
3
+ class VariableNode < Node
4
+ def initialize(name, expr, guarded, options)
5
+ @name = name
6
+ @expr = expr
7
+ @guarded = guarded
8
+ super(options)
9
+ end
10
+
11
+ protected
12
+
13
+ def _perform(environment)
14
+ if @guarded && environment.var(@name).nil?
15
+ environment.set_var(@name, @expr.perform(environment))
16
+ elsif !@guarded
17
+ environment.set_var(@name, @expr.perform(environment))
18
+ end
19
+
20
+ []
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ require 'sass/tree/node'
2
+
3
+ module Sass::Tree
4
+ class WhileNode < Node
5
+ def initialize(expr, options)
6
+ @expr = expr
7
+ super(options)
8
+ end
9
+
10
+ private
11
+
12
+ def _perform(environment)
13
+ children = []
14
+ while @expr.perform(environment).to_bool
15
+ children += perform_children(Sass::Environment.new(environment))
16
+ end
17
+ children
18
+ end
19
+ end
20
+ end