Link to index pages from the search page, link ruby functions to their appropriate compass docs, where they exist.

This commit is contained in:
Chris Eppstein 2011-01-05 09:34:45 -08:00
parent df756b194c
commit 2e2b384327
15 changed files with 75 additions and 3 deletions

View File

@ -16,4 +16,9 @@ body_id: home
%h1#logo All Ruby Based Functions
%ul
- Sass::Script::Functions.public_instance_methods.sort_by{|m| m.to_s}.each do |m|
%li= m.to_s.gsub("_","-")
%li
- name = m.to_s.gsub("_","-")
- if i = item_for_function_name(name)
%a{:href=>"#{i.path}##{name}"}= name
- else
= name

View File

@ -8,6 +8,8 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "color-stops"
---
%h1 Compass Color Stops Helper

View File

@ -8,6 +8,11 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "adjust-lightness"
- "adjust-saturation"
- "scale-lightness"
- "scale-saturation"
---
%h1 Compass Color Helpers
%p

View File

@ -8,6 +8,8 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "opposite-position"
---
%h1 Compass Constant Helpers

View File

@ -8,6 +8,16 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "prefixed"
- "prefix"
- "-webkit"
- "-moz"
- "-o"
- "-ms"
- "-svg"
- "-pie"
- "-css2"
---
%h1 Compass Cross Browser Helpers

View File

@ -8,6 +8,8 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "elements-of-type"
---
%h1 Compass Display Helpers

View File

@ -8,6 +8,8 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "font-files"
---
%h1 Compass Font Files Helper

View File

@ -8,6 +8,9 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "image-width"
- "image-height"
---
%h1 Compass Image Dimension Helpers

View File

@ -8,6 +8,9 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "inline-image"
- "inline-font-files"
---
%h1 Compass Inline Data Helpers

View File

@ -8,6 +8,12 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "nest"
- "append-selector"
- "enumerate"
- "headings"
- "headers"
---
%h1 Compass Selector Helpers
@ -67,6 +73,7 @@ classnames:
%li
%a(href="/examples/compass/helpers/using-extend-in-place-of-enumerate/") Example of using <code>@extend</code> in place of enumerate
%a(name="headers")
#headings.helper
%h3
%a(href="#append-selector")

View File

@ -8,6 +8,13 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "sprite-map"
- "sprite"
- "sprite-map-name"
- "sprite-file"
- "sprite-url"
- "sprite-position"
---
%h1 Compass Sprite Helpers

View File

@ -8,6 +8,11 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "pi"
- "sin"
- "cos"
- "tan"
---
%h1 Compass Trig Helpers

View File

@ -8,6 +8,10 @@ classnames:
- reference
- core
- helpers
documented_functions:
- "stylesheet-url"
- "font-url"
- "image-url"
---
%h1 Compass URL Helpers

View File

@ -30,5 +30,15 @@ body_id: search
}
%input#q{:type => "text", :placeholder=>"Search"}
%h2 Index of all:
%ul#indexes
%li
%a(href="/index/variables/") Variables
%li
%a(href="/index/mixins/") Mixins
%li
%a(href="/index/functions/") Functions
%h2 Results
%ol#results
%li.none Please enter a search term.

View File

@ -176,12 +176,11 @@ def all_mixins
end
def all_functions
rv = @items.inject([]) do |all_functions, item|
@items.inject([]) do |all_functions, item|
next all_functions unless item.identifier =~ %r{/reference}
next all_functions unless item[:stylesheet]
all_functions += functions(item).map{|f| [item, f] }
end
rv
end
def example_items
@ -192,6 +191,12 @@ def example_items
end
end
def item_for_function_name(function_name)
@items.detect do |item|
(item.identifier =~ %r{helpers}) && item[:documented_functions] && item[:documented_functions].include?(function_name)
end
end
def examples_for_item(item)
@site.cached("examples/#{item.identifier}") do
example_items.select do |i|