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

[Sass] Allow variables to be defined with :.

This commit is contained in:
Nathan Weizenbaum 2010-03-26 17:24:02 -07:00
parent ae3bf97078
commit db151db275
3 changed files with 4 additions and 4 deletions

View file

@ -427,8 +427,8 @@ WARNING
Script.var_warning(name, @line, line.offset + 1, @options[:filename]) if line.text[0] == ?!
expr = parse_script(value, :offset => line.offset + line.text.index(value))
expr.context = :equals
Tree::VariableNode.new(name, expr, op == '||=')
expr.context = :equals if op =~ /=$/
Tree::VariableNode.new(name, expr, op =~ /^\|\|/)
end
def parse_comment(line)

View file

@ -14,7 +14,7 @@ module Sass
module Script
# The regular expression used to parse variables.
# @private
MATCH = /^[!\$](#{Sass::SCSS::RX::IDENT})\s*((?:\|\|)?=)\s*(.+)/
MATCH = /^[!\$](#{Sass::SCSS::RX::IDENT})\s*((?:\|\|)?[:=])\s*(.+)/
# The regular expression used to validate variables without matching.
# @private

View file

@ -17,7 +17,7 @@ module Sass
protected
def to_src(tabs, opts, fmt)
"#{' ' * tabs}$#{@name} #{'||' if @guarded}= #{@expr.to_sass}#{semi fmt}\n"
"#{' ' * tabs}$#{@name} #{'||' if @guarded}: #{@expr.to_sass}#{semi fmt}\n"
end
# Loads the new variable value into the environment.