vendor/plugins/haml/lib/sass/engine.rb in radiant-0.7.2 vs vendor/plugins/haml/lib/sass/engine.rb in radiant-0.8.0
- old
+ new
@@ -110,14 +110,15 @@
split_lines
root = Tree::Node.new(@options[:style])
index = 0
while @lines[index]
+ old_index = index
child, index = build_tree(index)
if child.is_a? Tree::Node
- child.line = index
+ child.line = old_index + 1
root << child
elsif child.is_a? Array
child.each do |c|
root << c
end
@@ -275,11 +276,17 @@
end
def parse_line(line)
case line[0]
when ATTRIBUTE_CHAR
- parse_attribute(line, ATTRIBUTE)
+ if line[1] != ATTRIBUTE_CHAR
+ parse_attribute(line, ATTRIBUTE)
+ else
+ # Support CSS3-style pseudo-elements,
+ # which begin with ::
+ Tree::RuleNode.new(line, @options[:style])
+ end
when Constant::CONSTANT_CHAR
parse_constant(line)
when COMMENT_CHAR
parse_comment(line)
when DIRECTIVE_CHAR
@@ -362,11 +369,11 @@
Tree::DirectiveNode.new(line, @options[:style])
end
end
def parse_mixin_definition(line)
- mixin_name = line[1..-1]
+ mixin_name = line[1..-1].strip
@mixins[mixin_name] = []
index = @line
line, tabs = @lines[index]
while !line.nil? && tabs > 0
child, index = build_tree(index)
@@ -437,18 +444,12 @@
return filename
end
new_filename = find_full_path("#{filename}.sass", load_paths)
- if new_filename.nil?
- if was_sass
- raise Exception.new("File to import not found or unreadable: #{original_filename}.")
- else
- return filename + '.css'
- end
- else
- new_filename
- end
+ return new_filename if new_filename
+ return filename + '.css' unless was_sass
+ raise SyntaxError.new("File to import not found or unreadable: #{original_filename}.", @line)
end
def self.find_full_path(filename, load_paths)
load_paths.each do |path|
["_#{filename}", filename].each do |name|