Improves index/functions - adds links to sass functions and differentiate them from Compass ones.

This commit is contained in:
Mario Kuroir Ricalde 2011-12-28 02:57:00 -06:00
parent 1046a553c7
commit 55b049e1fa
2 changed files with 22 additions and 6 deletions

View File

@ -13,12 +13,22 @@ body_id: home
%li %li
%a{:href=>"#{i.path}#function-#{f.name}"}= f.sass_signature(:html) %a{:href=>"#{i.path}#function-#{f.name}"}= f.sass_signature(:html)
- sass_function_list = []
%h1#logo All Ruby Based Functions %h1#logo All Ruby Based Functions
%h3 Compass Functions
%ul %ul
- Sass::Script::Functions.public_instance_methods.sort_by{|m| m.to_s}.each do |m| - 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) - if i = item_for_function_name(name)
%li
%a{:href=>"#{i.path}##{name}"}= name %a{:href=>"#{i.path}##{name}"}= name
- elsif sass_functions().include? m
- sass_function_list << '<a href="http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#%s-instance_method">%s</a>' % [m.to_s, name]
- else - else
%li
= name = name
%h3 Sass Functions
%ul
- sass_function_list.each do |m|
%li= m

View File

@ -183,6 +183,12 @@ def all_functions
end end
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 def example_items
@site.cached("examples") do @site.cached("examples") do
@items.select do |i| @items.select do |i|