"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/sass/tree/visitors/to_css.rb" between
sass-3.5.5.tar.gz and sass-3.5.6.tar.gz

About: Sass (Syntactically Awesome StyleSheets) is a CSS preprocessor (extension language) that adds "power and elegance" to the basic CSS language.

to_css.rb  (sass-3.5.5):to_css.rb  (sass-3.5.6)
skipping to change at line 395 skipping to change at line 395
end end
private private
# Reformats the value of `node` so that it's nicely indented, preserving its # Reformats the value of `node` so that it's nicely indented, preserving its
# existing relative indentation. # existing relative indentation.
# #
# @param node [Sass::Script::Tree::PropNode] A custom property node. # @param node [Sass::Script::Tree::PropNode] A custom property node.
# @return [String] # @return [String]
def format_custom_property_value(node) def format_custom_property_value(node)
if node.style == :compact || node.style == :compressed || !node.resolved_val value = node.resolved_value.sub(/\n[ \t\r\f\n]*\Z/, ' ')
ue.include?("\n") if node.style == :compact || node.style == :compressed || !value.include?("\
n")
# Folding not involving newlines was done in the parser. We can safely # Folding not involving newlines was done in the parser. We can safely
# fold newlines here because tokens like strings can't contain literal # fold newlines here because tokens like strings can't contain literal
# newlines, so we know any adjacent whitespace is tokenized as whitespace. # newlines, so we know any adjacent whitespace is tokenized as whitespace.
return node.resolved_value.gsub(/[ \t\r\f]*\n[ \t\r\f\n]*/, ' ') return node.resolved_value.gsub(/[ \t\r\f]*\n[ \t\r\f\n]*/, ' ')
end end
# Find the smallest amount of indentation in the custom property and use # Find the smallest amount of indentation in the custom property and use
# that as the base indentation level. # that as the base indentation level.
lines = node.resolved_value.split("\n") lines = value.split("\n")
indented_lines = lines[1..-1] indented_lines = lines[1..-1]
min_indentation = indented_lines. min_indentation = indented_lines.
map {|line| line[/^[ \t]*/]}. map {|line| line[/^[ \t]*/]}.
reject {|line| line.empty?}. reject {|line| line.empty?}.
min_by {|line| line.length} min_by {|line| line.length}
# Limit the base indentation to the same indentation level as the node name # Limit the base indentation to the same indentation level as the node name
# so that if *every* line is indented relative to the property name that's # so that if *every* line is indented relative to the property name that's
# preserved. # preserved.
if node.name_source_range if node.name_source_range
 End of changes. 2 change blocks. 
3 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)