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:
parent
2ba54584f2
commit
da671b70d3
2 changed files with 4 additions and 7 deletions
|
@ -302,7 +302,7 @@ END
|
||||||
|
|
||||||
def parse_comment(line)
|
def parse_comment(line)
|
||||||
if line[1] == CSS_COMMENT_CHAR || line[1] == SASS_COMMENT_CHAR
|
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
|
else
|
||||||
Tree::RuleNode.new(line, @options)
|
Tree::RuleNode.new(line, @options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,8 +4,9 @@ module Sass::Tree
|
||||||
class CommentNode < Node
|
class CommentNode < Node
|
||||||
attr_accessor :value
|
attr_accessor :value
|
||||||
|
|
||||||
def initialize(value, options)
|
def initialize(value, silent, options)
|
||||||
@value = value[2..-1].strip
|
@value = value[2..-1].strip
|
||||||
|
@silent = silent
|
||||||
super(options)
|
super(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,12 +18,8 @@ module Sass::Tree
|
||||||
self.value == other.value && super
|
self.value == other.value && super
|
||||||
end
|
end
|
||||||
|
|
||||||
def silent?
|
|
||||||
!!@options[:silent]
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s(tabs = 0, parent_name = nil)
|
def to_s(tabs = 0, parent_name = nil)
|
||||||
return if (style == :compressed || silent?)
|
return if (style == :compressed || @silent)
|
||||||
|
|
||||||
spaces = ' ' * (tabs - 1)
|
spaces = ' ' * (tabs - 1)
|
||||||
spaces + "/* " + ([value] + children.map {|c| c.text}).
|
spaces + "/* " + ([value] + children.map {|c| c.text}).
|
||||||
|
|
Loading…
Add table
Reference in a new issue