1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Deal with silent comments in a less hacky manner.

This commit is contained in:
Nathan Weizenbaum 2009-04-21 19:22:52 -07:00
parent 2ba54584f2
commit da671b70d3
2 changed files with 4 additions and 7 deletions

View file

@ -302,7 +302,7 @@ END
def parse_comment(line)
if line[1] == CSS_COMMENT_CHAR || line[1] == SASS_COMMENT_CHAR
Tree::CommentNode.new(line, @options.merge(:silent => (line[1] == SASS_COMMENT_CHAR)))
Tree::CommentNode.new(line, line[1] == SASS_COMMENT_CHAR, @options)
else
Tree::RuleNode.new(line, @options)
end

View file

@ -4,8 +4,9 @@ module Sass::Tree
class CommentNode < Node
attr_accessor :value
def initialize(value, options)
def initialize(value, silent, options)
@value = value[2..-1].strip
@silent = silent
super(options)
end
@ -17,12 +18,8 @@ module Sass::Tree
self.value == other.value && super
end
def silent?
!!@options[:silent]
end
def to_s(tabs = 0, parent_name = nil)
return if (style == :compressed || silent?)
return if (style == :compressed || @silent)
spaces = ' ' * (tabs - 1)
spaces + "/* " + ([value] + children.map {|c| c.text}).