From 55b049e1fac061f5303d595db3643770404504e7 Mon Sep 17 00:00:00 2001 From: Mario Kuroir Ricalde Date: Wed, 28 Dec 2011 02:57:00 -0600 Subject: [PATCH] Improves index/functions - adds links to sass functions and differentiate them from Compass ones. --- doc-src/content/index/functions.haml | 20 +++++++++++++++----- doc-src/lib/stylesheets.rb | 8 +++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc-src/content/index/functions.haml b/doc-src/content/index/functions.haml index 3db82d99..03b28450 100644 --- a/doc-src/content/index/functions.haml +++ b/doc-src/content/index/functions.haml @@ -5,7 +5,7 @@ body_id: home --- %article %h1#logo Sass Based Functions - + - all_functions.sorted_and_grouped_by_name{|f| f.last.name }.each do |(group, functions)| %h3= group %ul @@ -13,12 +13,22 @@ body_id: home %li %a{:href=>"#{i.path}#function-#{f.name}"}= f.sass_signature(:html) + - sass_function_list = [] %h1#logo All Ruby Based Functions + %h3 Compass Functions %ul - Sass::Script::Functions.public_instance_methods.sort_by{|m| m.to_s}.each do |m| - %li - - name = m.to_s.gsub("_","-") + - name = m.to_s.gsub("_","-") + - unless name =~ /^\-compass/ # Private Fuctions! - if i = item_for_function_name(name) - %a{:href=>"#{i.path}##{name}"}= name + %li + %a{:href=>"#{i.path}##{name}"}= name + - elsif sass_functions().include? m + - sass_function_list << '%s' % [m.to_s, name] - else - = name \ No newline at end of file + %li + = name + %h3 Sass Functions + %ul + - sass_function_list.each do |m| + %li= m \ No newline at end of file diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index 6fa56b6b..4bd2e6f1 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -60,7 +60,7 @@ def import_paths File.dirname(@item[:stylesheet])), @item[:stylesheet]["/"] ? File.dirname(@item[:stylesheet]) : ""] end - + paths += Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory}.map!{|p|[p, '']} paths end @@ -183,6 +183,12 @@ def all_functions end end +# Sass Only Functions from 3.1.10 (Brainy Betty) +# Not as elegant, but does the trick. +def sass_functions + [:rgb, :rgba, :hsl, :hsla, :red, :green, :blue, :hue, :saturation, :lightness, :alpha, :opacity, :opacify, :fade_in, :transparentize, :fade_out, :lighten, :darken, :saturate, :desaturate, :adjust_hue, :adjust_color, :scale_color, :change_color, :mix, :grayscale, :complement, :invert, :unquote, :quote, :type_of, :unit, :unitless, :comparable, :percentage, :round, :ceil, :floor, :abs, :length, :nth, :join, :append, :zip, :index, :if] +end + def example_items @site.cached("examples") do @items.select do |i|