From 6b4290472cc154c832be1d91380ff57f6f8e4c4d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 28 Jan 2010 09:43:27 -0800 Subject: [PATCH] Fix some operator output in to_sass. --- doc-src/lib/stylesheets/sass_extensions.rb | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/doc-src/lib/stylesheets/sass_extensions.rb b/doc-src/lib/stylesheets/sass_extensions.rb index bdde44c8..90af56fd 100644 --- a/doc-src/lib/stylesheets/sass_extensions.rb +++ b/doc-src/lib/stylesheets/sass_extensions.rb @@ -54,7 +54,7 @@ module Sass class CommentNode < Node def to_sass comment = silent ? "//" : "/*" - comment << value + comment << " " << value lines.each do |line| comment << " " << line end @@ -204,20 +204,20 @@ module Sass class Operation < Node unless defined? OPERATORS_TO_SASS OPERATORS_TO_SASS = { - :plus => '+', - :minus => '-', - :div => '/', - :mult => '*', - :comma => ',', + :plus => ' + ', + :minus => ' - ', + :div => ' / ', + :times => ' * ', + :comma => ', ', :concat => ' ', - :neq => '!=', - :eq => '==', - :or => 'or', - :and => 'and' + :neq => ' ! =', + :eq => ' == ', + :or => ' or ', + :and => ' and ' } end def to_sass(format = :text) - "#{operand_to_sass(@operand1, format)} #{OPERATORS_TO_SASS[@operator]} #{operand_to_sass(@operand2, format)}" + "#{operand_to_sass(@operand1, format)}#{OPERATORS_TO_SASS[@operator]}#{operand_to_sass(@operand2, format)}" end def operand_to_sass(operand, format = :text) if operand.is_a? Operation @@ -233,8 +233,13 @@ module Sass end end class UnaryOperation < Node + OPERATORS_TO_SASS = { + :minus => "-", + :div => "/", + :not => "not " + } def to_sass(format = :text) - "#{@operator}#{@operand}" + "#{OPERATORS_TO_SASS[@operator]}#{@operand.to_sass}" end end class Variable < Node