haml-edge 2.3.179 → 2.3.180

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.
Files changed (92) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/README.md +88 -149
  3. data/VERSION +1 -1
  4. data/bin/css2sass +7 -1
  5. data/bin/sass-convert +7 -0
  6. data/lib/haml/exec.rb +95 -22
  7. data/lib/haml/template.rb +1 -1
  8. data/lib/haml/util.rb +50 -0
  9. data/lib/sass.rb +1 -1
  10. data/lib/sass/css.rb +38 -210
  11. data/lib/sass/engine.rb +121 -47
  12. data/lib/sass/files.rb +28 -19
  13. data/lib/sass/plugin.rb +32 -43
  14. data/lib/sass/repl.rb +1 -1
  15. data/lib/sass/script.rb +25 -6
  16. data/lib/sass/script/bool.rb +1 -0
  17. data/lib/sass/script/color.rb +2 -2
  18. data/lib/sass/script/css_lexer.rb +22 -0
  19. data/lib/sass/script/css_parser.rb +28 -0
  20. data/lib/sass/script/funcall.rb +17 -9
  21. data/lib/sass/script/functions.rb +46 -1
  22. data/lib/sass/script/interpolation.rb +42 -0
  23. data/lib/sass/script/lexer.rb +142 -34
  24. data/lib/sass/script/literal.rb +28 -12
  25. data/lib/sass/script/node.rb +57 -1
  26. data/lib/sass/script/number.rb +18 -3
  27. data/lib/sass/script/operation.rb +44 -8
  28. data/lib/sass/script/parser.rb +149 -24
  29. data/lib/sass/script/string.rb +50 -2
  30. data/lib/sass/script/unary_operation.rb +25 -10
  31. data/lib/sass/script/variable.rb +20 -11
  32. data/lib/sass/scss.rb +14 -0
  33. data/lib/sass/scss/css_parser.rb +39 -0
  34. data/lib/sass/scss/parser.rb +683 -0
  35. data/lib/sass/scss/rx.rb +112 -0
  36. data/lib/sass/scss/script_lexer.rb +13 -0
  37. data/lib/sass/scss/script_parser.rb +25 -0
  38. data/lib/sass/tree/comment_node.rb +58 -16
  39. data/lib/sass/tree/debug_node.rb +7 -2
  40. data/lib/sass/tree/directive_node.rb +38 -34
  41. data/lib/sass/tree/for_node.rb +6 -0
  42. data/lib/sass/tree/if_node.rb +13 -0
  43. data/lib/sass/tree/import_node.rb +26 -7
  44. data/lib/sass/tree/mixin_def_node.rb +18 -0
  45. data/lib/sass/tree/mixin_node.rb +16 -1
  46. data/lib/sass/tree/node.rb +98 -27
  47. data/lib/sass/tree/prop_node.rb +97 -20
  48. data/lib/sass/tree/root_node.rb +37 -0
  49. data/lib/sass/tree/rule_node.rb +88 -60
  50. data/lib/sass/tree/variable_node.rb +9 -5
  51. data/lib/sass/tree/while_node.rb +4 -0
  52. data/test/haml/results/filters.xhtml +1 -1
  53. data/test/haml/util_test.rb +28 -0
  54. data/test/sass/conversion_test.rb +884 -0
  55. data/test/sass/css2sass_test.rb +46 -21
  56. data/test/sass/engine_test.rb +680 -160
  57. data/test/sass/functions_test.rb +27 -0
  58. data/test/sass/more_results/more_import.css +1 -1
  59. data/test/sass/more_templates/more_import.sass +3 -3
  60. data/test/sass/plugin_test.rb +28 -8
  61. data/test/sass/results/compact.css +1 -1
  62. data/test/sass/results/complex.css +5 -5
  63. data/test/sass/results/compressed.css +1 -1
  64. data/test/sass/results/expanded.css +1 -1
  65. data/test/sass/results/import.css +3 -1
  66. data/test/sass/results/mixins.css +12 -12
  67. data/test/sass/results/nested.css +1 -1
  68. data/test/sass/results/parent_ref.css +4 -4
  69. data/test/sass/results/script.css +3 -3
  70. data/test/sass/results/scss_import.css +15 -0
  71. data/test/sass/results/scss_importee.css +2 -0
  72. data/test/sass/script_conversion_test.rb +153 -0
  73. data/test/sass/script_test.rb +44 -54
  74. data/test/sass/scss/css_test.rb +811 -0
  75. data/test/sass/scss/rx_test.rb +156 -0
  76. data/test/sass/scss/scss_test.rb +871 -0
  77. data/test/sass/scss/test_helper.rb +37 -0
  78. data/test/sass/templates/alt.sass +2 -2
  79. data/test/sass/templates/bork1.sass +1 -1
  80. data/test/sass/templates/import.sass +4 -4
  81. data/test/sass/templates/importee.sass +3 -3
  82. data/test/sass/templates/line_numbers.sass +1 -1
  83. data/test/sass/templates/mixins.sass +2 -2
  84. data/test/sass/templates/nested_mixin_bork.sass +1 -1
  85. data/test/sass/templates/options.sass +1 -1
  86. data/test/sass/templates/parent_ref.sass +2 -2
  87. data/test/sass/templates/script.sass +69 -69
  88. data/test/sass/templates/scss_import.scss +10 -0
  89. data/test/sass/templates/scss_importee.scss +1 -0
  90. data/test/sass/templates/units.sass +10 -10
  91. data/test/test_helper.rb +4 -4
  92. metadata +27 -2
data/lib/sass/files.rb CHANGED
@@ -11,7 +11,7 @@ module Sass
11
11
  # Returns the {Sass::Tree} for the given file,
12
12
  # reading it from the Sass cache if possible.
13
13
  #
14
- # @param filename [String] The path to the Sass file
14
+ # @param filename [String] The path to the Sass or SCSS file
15
15
  # @param options [{Symbol => Object}] The options hash.
16
16
  # Only the {file:SASS_REFERENCE.md#cache-option `:cache_location`} option is used
17
17
  # @raise [Sass::SyntaxError] if there's an error in the document.
@@ -30,50 +30,59 @@ module Sass
30
30
  end
31
31
  end
32
32
 
33
- engine = Sass::Engine.new(text, options.merge(:filename => filename))
33
+ options = options.merge(:filename => filename)
34
+ if filename =~ /\.scss$/
35
+ options = options.merge(:syntax => :scss)
36
+ elsif filename =~ /\.sass$/
37
+ options = options.merge(:syntax => :sass)
38
+ end
39
+
40
+ engine = Sass::Engine.new(text, options)
34
41
 
35
42
  root = engine.to_tree
36
43
  try_to_write_sassc(root, compiled_filename, sha, options) if options[:cache]
37
44
  root
38
45
  end
39
46
 
40
- # Find the full filename of a Sass or CSS file to import.
47
+ # Find the full filename of a Sass, SCSS, or CSS file to import.
41
48
  # This follows Sass's import rules:
42
- # if the filename given ends in `".sass"` or `".css"`,
49
+ # if the filename given ends in `".sass"`, `".scss"`, or `".css"`,
43
50
  # it will try to find that type of file;
44
- # otherwise, it will try to find the corresponding Sass file
51
+ # otherwise, it will try to find the corresponding Sass/SCSS file
45
52
  # and fall back on CSS if it's not available.
46
53
  #
47
- # Any Sass filename returned will correspond to
48
- # an actual Sass file on the filesystem.
54
+ # Any Sass/SCSS filename returned will correspond to
55
+ # an actual file of the corresponding type on the filesystem.
49
56
  # CSS filenames, however, may not;
50
57
  # they're expected to be put through directly to the stylesheet
51
58
  # as CSS `@import` statements.
52
59
  #
53
60
  # @param filename [String] The filename to search for
54
61
  # @param load_paths [Array<String>] The set of filesystem paths
55
- # to search for Sass files.
62
+ # to search for Sass/SCSS files.
56
63
  # @return [String] The filename of the imported file.
57
- # This is an absolute path if the file is a `".sass"` file.
58
- # @raise [Sass::SyntaxError] if `filename` ends in ``".sass"``
59
- # and no corresponding Sass file could be found.
64
+ # This is an absolute path if the file is a `".sass"` or `".scss"` file.
65
+ # @raise [Sass::SyntaxError] if `filename` ends in `".sass"` or `".scss"`
66
+ # and no corresponding Sass/SCSS file could be found.
60
67
  def find_file_to_import(filename, load_paths)
61
- was_sass = false
68
+ was_sass = was_scss = false
62
69
  original_filename = filename
63
70
 
64
- if filename[-5..-1] == ".sass"
71
+ if [".sass", ".scss"].include?(filename[-5..-1])
72
+ was_sass = filename[-5..-1] == ".sass"
73
+ was_scss = filename[-5..-1] == ".scss"
65
74
  filename = filename[0...-5]
66
- was_sass = true
67
75
  elsif filename[-4..-1] == ".css"
68
76
  return filename
69
77
  end
70
78
 
71
- new_filename = find_full_path("#{filename}.sass", load_paths)
79
+ new_filename = find_full_path("#{filename}.sass", load_paths) unless was_scss
80
+ new_filename ||= find_full_path("#{filename}.scss", load_paths) unless was_sass
72
81
 
73
82
  return new_filename if new_filename
74
- unless was_sass
75
- warn <<END
76
- WARNING: #{filename}.sass not found. Using #{filename}.css instead.
83
+ unless was_sass || was_scss
84
+ Haml::Util.haml_warn <<END
85
+ WARNING: Neither #{filename}.sass nor .scss found. Using #{filename}.css instead.
77
86
  This behavior is deprecated and will be removed in a future version.
78
87
  If you really need #{filename}.css, import it explicitly.
79
88
  END
@@ -107,7 +116,7 @@ END
107
116
  return Marshal.load(f.read)
108
117
  end
109
118
  rescue EOFError, TypeError, ArgumentError => e
110
- warn "Warning. Error encountered while reading cache #{compiled_filename}: #{e}"
119
+ Haml::Util.haml_warn "Warning. Error encountered while reading cache #{compiled_filename}: #{e}"
111
120
  end
112
121
 
113
122
  def try_to_write_sassc(root, compiled_filename, sha, options)
data/lib/sass/plugin.rb CHANGED
@@ -5,7 +5,7 @@ require 'sass'
5
5
  require 'sass/callbacks'
6
6
 
7
7
  module Sass
8
- # This module handles the compilation of Sass files.
8
+ # This module handles the compilation of Sass/SCSS files.
9
9
  # It provides global options and checks whether CSS files
10
10
  # need to be updated.
11
11
  #
@@ -25,9 +25,9 @@ module Sass
25
25
  # puts "Compiling #{template} to #{css}"
26
26
  # end
27
27
  # Sass::Plugin.update_stylesheets
28
- # #=> Compiling app/sass/screen.sass to public/stylesheets/screen.css
29
- # #=> Compiling app/sass/print.sass to public/stylesheets/print.css
30
- # #=> Compiling app/sass/ie.sass to public/stylesheets/ie.css
28
+ # #=> Compiling app/sass/screen.scss to public/stylesheets/screen.css
29
+ # #=> Compiling app/sass/print.scss to public/stylesheets/print.css
30
+ # #=> Compiling app/sass/ie.scss to public/stylesheets/ie.css
31
31
  module Plugin
32
32
  include Haml::Util
33
33
  include Sass::Callbacks
@@ -65,7 +65,7 @@ module Sass
65
65
  #
66
66
  # @yield [template, css]
67
67
  # @yieldparam template [String]
68
- # The location of the Sass file being updated.
68
+ # The location of the Sass/SCSS file being updated.
69
69
  # @yieldparam css [String]
70
70
  # The location of the CSS file being generated.
71
71
  define_callback :updating_stylesheet
@@ -81,7 +81,7 @@ module Sass
81
81
  #
82
82
  # @yield [template, css]
83
83
  # @yieldparam template [String]
84
- # The location of the Sass file not being updated.
84
+ # The location of the Sass/SCSS file not being updated.
85
85
  # @yieldparam css [String]
86
86
  # The location of the CSS file not being generated.
87
87
  define_callback :not_updating_stylesheet
@@ -94,7 +94,7 @@ module Sass
94
94
  # @yield [error, template, css]
95
95
  # @yieldparam error [Exception] The exception that was raised.
96
96
  # @yieldparam template [String]
97
- # The location of the Sass file being updated.
97
+ # The location of the Sass/SCSS file being updated.
98
98
  # @yieldparam css [String]
99
99
  # The location of the CSS file being generated.
100
100
  define_callback :compilation_error
@@ -142,7 +142,7 @@ module Sass
142
142
  define_callback :template_deleted
143
143
 
144
144
  # Register a callback to be run when Sass deletes a CSS file.
145
- # This happens when the corresponding Sass file has been deleted.
145
+ # This happens when the corresponding Sass/SCSS file has been deleted.
146
146
  #
147
147
  # @yield [filename]
148
148
  # @yieldparam filename [String]
@@ -192,7 +192,7 @@ module Sass
192
192
 
193
193
  # Updates out-of-date stylesheets.
194
194
  #
195
- # Checks each Sass file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
195
+ # Checks each Sass/SCSS file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
196
196
  # to see if it's been modified more recently than the corresponding CSS file
197
197
  # in {file:SASS_REFERENCE.md#css_location-option `:css_location`}.
198
198
  # If it has, it updates the CSS file.
@@ -201,7 +201,7 @@ module Sass
201
201
  # A list of files to check for updates
202
202
  # **in addition to those specified by the
203
203
  # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
204
- # The first string in each pair is the location of the Sass file,
204
+ # The first string in each pair is the location of the Sass/SCSS file,
205
205
  # the second is the location of the CSS file that it should be compiled to.
206
206
  def update_stylesheets(individual_files = [])
207
207
  return if options[:never_update]
@@ -213,32 +213,30 @@ module Sass
213
213
  @checked_for_updates = true
214
214
  template_locations.zip(css_locations).each do |template_location, css_location|
215
215
 
216
- Dir.glob(File.join(template_location, "**", "*.sass")).each do |file|
217
- # Get the relative path to the file with no extension
218
- name = file.sub(template_location.sub(/\/*$/, '/'), "")[0...-5]
216
+ Dir.glob(File.join(template_location, "**", "*.s[ca]ss")).each do |file|
217
+ # Get the relative path to the file
218
+ name = file.sub(template_location.sub(/\/*$/, '/'), "")
219
+ css = css_filename(name, css_location)
219
220
 
220
221
  next if forbid_update?(name)
221
-
222
- filename = template_filename(name, template_location)
223
- css = css_filename(name, css_location)
224
- if options[:always_update] || stylesheet_needs_update?(name, template_location, css_location)
225
- update_stylesheet filename, css
222
+ if options[:always_update] || stylesheet_needs_update?(css, file)
223
+ update_stylesheet file, css
226
224
  else
227
- run_not_updating_stylesheet filename, css
225
+ run_not_updating_stylesheet file, css
228
226
  end
229
227
  end
230
228
  end
231
229
  end
232
230
 
233
231
  # Watches the template directory (or directories)
234
- # and updates the CSS files whenever the related Sass files change.
232
+ # and updates the CSS files whenever the related Sass/SCSS files change.
235
233
  # `watch` never returns.
236
234
  #
237
- # Whenever a change is detected to a Sass file in
235
+ # Whenever a change is detected to a Sass/SCSS file in
238
236
  # {file:SASS_REFERENCE.md#template_location-option `:template_location`},
239
237
  # the corresponding CSS file in {file:SASS_REFERENCE.md#css_location-option `:css_location`}
240
238
  # will be recompiled.
241
- # The CSS files of any Sass files that import the changed file will also be recompiled.
239
+ # The CSS files of any Sass/SCSS files that import the changed file will also be recompiled.
242
240
  #
243
241
  # Before the watching starts in earnest, `watch` calls \{#update\_stylesheets}.
244
242
  #
@@ -252,7 +250,7 @@ module Sass
252
250
  # A list of files to watch for updates
253
251
  # **in addition to those specified by the
254
252
  # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
255
- # The first string in each pair is the location of the Sass file,
253
+ # The first string in each pair is the location of the Sass/SCSS file,
256
254
  # the second is the location of the CSS file that it should be compiled to.
257
255
  def watch(individual_files = [])
258
256
  update_stylesheets(individual_files)
@@ -274,7 +272,7 @@ module Sass
274
272
  FSSM.monitor do |mon|
275
273
  template_locations.zip(css_locations).each do |template_location, css_location|
276
274
  mon.path template_location do |path|
277
- path.glob '**/*.sass'
275
+ path.glob '**/*.s[ac]ss'
278
276
 
279
277
  path.update do |base, relative|
280
278
  run_template_modified File.join(base, relative)
@@ -288,7 +286,7 @@ module Sass
288
286
 
289
287
  path.delete do |base, relative|
290
288
  run_template_deleted File.join(base, relative)
291
- css = File.join(css_location, relative.gsub(/\.sass$/, '.css'))
289
+ css = File.join(css_location, relative.gsub(/\.s[ac]ss$/, '.css'))
292
290
  try_delete_css css
293
291
  update_stylesheets(individual_files)
294
292
  end
@@ -368,26 +366,16 @@ module Sass
368
366
  end
369
367
  end
370
368
 
371
- def template_filename(name, path)
372
- "#{path}/#{name}.sass"
373
- end
374
-
375
369
  def css_filename(name, path)
376
- "#{path}/#{name}.css"
370
+ "#{path}/#{name}".gsub(/\.s[ac]ss$/, '.css')
377
371
  end
378
372
 
379
373
  def forbid_update?(name)
380
374
  name.sub(/^.*\//, '')[0] == ?_
381
375
  end
382
376
 
383
- def stylesheet_needs_update?(name, template_path, css_path)
384
- css_file = css_filename(name, css_path)
385
- template_file = template_filename(name, template_path)
386
- exact_stylesheet_needs_update?(css_file, template_file)
387
- end
388
-
389
- def exact_stylesheet_needs_update?(css_file, template_file)
390
- return true unless File.exists?(css_file)
377
+ def stylesheet_needs_update?(css_file, template_file)
378
+ return true unless File.exists?(css_file) && File.exists?(template_file)
391
379
 
392
380
  css_mtime = File.mtime(css_file)
393
381
  File.mtime(template_file) > css_mtime ||
@@ -407,11 +395,12 @@ module Sass
407
395
  end
408
396
 
409
397
  def dependencies(filename)
410
- File.readlines(filename).grep(/^@import /).map do |line|
411
- line[8..-1].split(',').map do |inc|
412
- Sass::Files.find_file_to_import(inc.strip, [File.dirname(filename)] + load_paths)
413
- end
414
- end.flatten.grep(/\.sass$/)
398
+ Files.tree_for(filename, engine_options).select {|n| n.is_a?(Tree::ImportNode)}.map do |n|
399
+ next if n.full_filename =~ /\.css$/
400
+ n.full_filename
401
+ end.compact
402
+ rescue Sass::SyntaxError => e
403
+ [] # If the file has an error, we assume it has no dependencies
415
404
  end
416
405
  end
417
406
  end
data/lib/sass/repl.rb CHANGED
@@ -35,7 +35,7 @@ module Sass
35
35
  case text
36
36
  when Script::MATCH
37
37
  name = $1
38
- guarded = $2 == '||='
38
+ guarded = $3 == '||=' || $4
39
39
  val = Script::Parser.parse($3, @line, text.size - $3.size)
40
40
 
41
41
  unless guarded && environment.var(name)
data/lib/sass/script.rb CHANGED
@@ -12,17 +12,13 @@ module Sass
12
12
  #
13
13
  # This module contains code that handles the parsing and evaluation of SassScript.
14
14
  module Script
15
- # The character that begins a variable.
16
- # @private
17
- VARIABLE_CHAR = ?!
18
-
19
15
  # The regular expression used to parse variables.
20
16
  # @private
21
- MATCH = /^!([a-zA-Z_-][\w-]*)\s*((?:\|\|)?=)\s*(.+)/
17
+ MATCH = /^[!\$](#{Sass::SCSS::RX::IDENT})\s*((?:\|\|)?=|:)\s*(.+?)(!(?i:default))?$/
22
18
 
23
19
  # The regular expression used to validate variables without matching.
24
20
  # @private
25
- VALIDATE = /^![a-zA-Z_-][\w-]*$/
21
+ VALIDATE = /^[!\$]#{Sass::SCSS::RX::IDENT}$/
26
22
 
27
23
  # Parses a string of SassScript
28
24
  #
@@ -41,5 +37,28 @@ module Sass
41
37
  e.modify_backtrace(:line => line, :filename => options[:filename])
42
38
  raise e
43
39
  end
40
+
41
+ # @private
42
+ def self.var_warning(varname, line, offset, filename)
43
+ Haml::Util.haml_warn <<MESSAGE
44
+ DEPRECATION WARNING:
45
+ On line #{line}, character #{offset}#{" of '#{filename}'" if filename}
46
+ Variables with ! have been deprecated and will be removed in version 3.2.
47
+ Use \"$#{varname}\" instead.
48
+
49
+ You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
50
+ MESSAGE
51
+ end
52
+
53
+ def self.equals_warning(types, name, val, guarded, line, offset, filename)
54
+ Haml::Util.haml_warn <<MESSAGE
55
+ DEPRECATION WARNING:
56
+ On line #{line}#{", character #{offset}" if offset}#{" of '#{filename}'" if filename}
57
+ Setting #{types} with #{"||" if guarded}= has been deprecated and will be removed in version 3.2.
58
+ Use "#{name}: #{val}#{" !default" if guarded}" instead.
59
+
60
+ You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
61
+ MESSAGE
62
+ end
44
63
  end
45
64
  end
@@ -13,5 +13,6 @@ module Sass::Script
13
13
  def to_s
14
14
  @value.to_s
15
15
  end
16
+ alias_method :to_sass, :to_s
16
17
  end
17
18
  end
@@ -184,7 +184,7 @@ module Sass::Script
184
184
  # @deprecated This will be removed in version 3.2.
185
185
  # @see #rgb
186
186
  def value
187
- warn <<END
187
+ Haml::Util.haml_warn <<END
188
188
  DEPRECATION WARNING:
189
189
  The Sass::Script::Color #value attribute is deprecated and will be
190
190
  removed in version 3.2. Use the #rgb attribute instead.
@@ -381,7 +381,7 @@ END
381
381
  return HTML4_COLORS_REVERSE[rgb] if HTML4_COLORS_REVERSE[rgb]
382
382
  hex_str
383
383
  end
384
- alias_method :inspect, :to_s
384
+ alias_method :to_sass, :to_s
385
385
 
386
386
  # Returns a string representation of the color.
387
387
  #
@@ -0,0 +1,22 @@
1
+ module Sass
2
+ module Script
3
+ class CssLexer < Lexer
4
+ def token
5
+ important || super
6
+ end
7
+
8
+ def string(*args)
9
+ return unless scan(STRING)
10
+ str = (@scanner[1] || @scanner[2]).
11
+ gsub(/\\([^0-9a-f])/, '\1').
12
+ gsub(/\\([0-9a-f]{1,4})/, "\\\\\\1")
13
+ [:string, Script::String.new(str, :string)]
14
+ end
15
+
16
+ def important
17
+ return unless s = scan(IMPORTANT)
18
+ [:raw, s]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ require 'sass/script'
2
+ require 'sass/script/css_lexer'
3
+
4
+ module Sass
5
+ module Script
6
+ class CssParser < Parser
7
+ private
8
+
9
+ # @private
10
+ def lexer_class; CssLexer; end
11
+
12
+ # We need a production that only does /,
13
+ # since * and % aren't allowed in plain CSS
14
+ production :div, :unary_plus, :div
15
+
16
+ def string
17
+ return number unless tok = try_tok(:string)
18
+ return tok.value unless @lexer.peek && @lexer.peek.type == :begin_interpolation
19
+ end
20
+
21
+ # Short-circuit all the SassScript-only productions
22
+ alias_method :interpolation, :concat
23
+ alias_method :or_expr, :div
24
+ alias_method :unary_div, :funcall
25
+ alias_method :paren, :string
26
+ end
27
+ end
28
+ end
@@ -22,6 +22,7 @@ module Sass
22
22
  def initialize(name, args)
23
23
  @name = name
24
24
  @args = args
25
+ super()
25
26
  end
26
27
 
27
28
  # @return [String] A string representation of the function call
@@ -29,12 +30,27 @@ module Sass
29
30
  "#{name}(#{args.map {|a| a.inspect}.join(', ')})"
30
31
  end
31
32
 
33
+ # @see Node#to_sass
34
+ def to_sass
35
+ "#{name}(#{args.map {|a| a.to_sass}.join(', ')})"
36
+ end
37
+
38
+ # Returns the arguments to the function.
39
+ #
40
+ # @return [Array<Node>]
41
+ # @see Node#children
42
+ def children
43
+ @args
44
+ end
45
+
46
+ protected
47
+
32
48
  # Evaluates the function call.
33
49
  #
34
50
  # @param environment [Sass::Environment] The environment in which to evaluate the SassScript
35
51
  # @return [Literal] The SassScript object that is the value of the function call
36
52
  # @raise [Sass::SyntaxError] if the function call raises an ArgumentError
37
- def perform(environment)
53
+ def _perform(environment)
38
54
  args = self.args.map {|a| a.perform(environment)}
39
55
  ruby_name = name.gsub('-', '_')
40
56
  unless Haml::Util.has?(:public_instance_method, Functions, ruby_name) && ruby_name !~ /^__/
@@ -48,14 +64,6 @@ module Sass
48
64
  raise e unless e.backtrace.any? {|t| t =~ /:in `(block in )?(#{name}|perform)'$/}
49
65
  raise Sass::SyntaxError.new("#{e.message} for `#{name}'")
50
66
  end
51
-
52
- # Returns the arguments to the function.
53
- #
54
- # @return [Array<Node>]
55
- # @see Node#children
56
- def children
57
- @args
58
- end
59
67
  end
60
68
  end
61
69
  end