[Docs] Make index pages that show all the available mixins and variables.

This commit is contained in:
Chris Eppstein 2010-08-01 09:52:17 -07:00
parent 922fc8c1a2
commit 704eaea0b2
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,14 @@
---
title: Compass Documentation | All Mixins
crumb: Docs
body_id: home
---
%article
%h1#logo Compass Mixins
- all_mixins.sort_by{|i| i.first.identifier}.each do |item, mixins|
%h3= link_to item[:title], item
%ul
- mixins.sort_by{|m| m.name}.each do |m|
%li= mixin_signature(m)

View File

@ -0,0 +1,15 @@
---
title: Compass Documentation | All Variables
crumb: Docs
body_id: home
---
%article
%h1#logo Compass Variables
- all_constants.sort_by{|i| i.first.identifier}.each do |item, constants|
%h3= link_to item[:title], item
%ul
- constants.sort_by{|c| c.name}.each do |c|
%li $#{c.name}

View File

@ -139,6 +139,32 @@ def constants(item)
constants constants
end end
def all_constants
variables = []
@items.each do |item|
next unless item.identifier =~ %r{/reference}
next unless item[:stylesheet]
vars = constants(item)
if vars.any?
variables << [item, vars]
end
end
variables
end
def all_mixins
all_mixins = []
@items.each do |item|
next unless item.identifier =~ %r{/reference}
next unless item[:stylesheet]
ms = mixins(item)
if ms.any?
all_mixins << [item, ms]
end
end
all_mixins
end
def mixin_signature(mixin, format = :html) def mixin_signature(mixin, format = :html)
mixin.sass_signature(:none, format) mixin.sass_signature(:none, format)
end end