aboutsummaryrefslogtreecommitdiff
path: root/_plugins/iterator.rb
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-06-11 15:58:53 -0400
committerBrandon Mathis <brandon@imathis.com>2011-06-11 15:58:53 -0400
commit913fa105c4a6793e6522ca45b85d8f06c803c6b9 (patch)
tree8047baaf313f6a0966b03c8a26a8988cdfa3c172 /_plugins/iterator.rb
parent814be44c151088dfb90d6a01281c9206151b0a88 (diff)
downloadmy_new_personal_website-913fa105c4a6793e6522ca45b85d8f06c803c6b9.tar.xz
my_new_personal_website-913fa105c4a6793e6522ca45b85d8f06c803c6b9.zip
1. Moved _plugins into themes/classic/_plugins
I think it's probably better to ship plugins with themes to make it easier to update them. 2. Improved 'install' rake task and made nicer output
Diffstat (limited to '_plugins/iterator.rb')
-rw-r--r--_plugins/iterator.rb49
1 files changed, 0 insertions, 49 deletions
diff --git a/_plugins/iterator.rb b/_plugins/iterator.rb
deleted file mode 100644
index da0b5f0a..00000000
--- a/_plugins/iterator.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-##
-## Author: Jose Gonzalez - https://github.com/josegonzalez
-## Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/iterator.rb
-##
-
-#module Jekyll
- #class Site
- #alias_method :orig_site_payload, :site_payload
-
- ## Constuct an array of hashes that will allow the user, using Liquid, to
- ## iterate through the keys of _kv_hash_ and be able to iterate through the
- ## elements under each key.
- ##
- ## Example:
- ## categories = { 'Ruby' => [<Post>, <Post>] }
- ## make_iterable(categories, :index => 'name', :items => 'posts')
- ## Will allow the user to iterate through all categories and then iterate
- ## though each post in the current category like so:
- ## {% for category in site.categories %}
- ## h1. {{ category.name }}
- ## <ul>
- ## {% for post in category.posts %}
- ## <li>{{ post.title }}</li>
- ## {% endfor %}
- ## </ul>
- ## {% endfor %}
- ##
- ## Returns [ {<index> => <kv_hash_key>, <items> => kv_hash[<kv_hash_key>]}, ... ]
-
- #def make_iterable(kv_hash, options)
- #options = {:index => 'name', :items => 'items'}.merge(options)
- #result = []
- #kv_hash.sort.each do |key, value|
- #result << { options[:index] => key, options[:items] => value }
- #end
- #result
- #end
-
- #def site_payload
- #payload = orig_site_payload
- #payload['site']['iterable'].merge!({
- #'categories' => make_iterable(self.categories, :index => 'name', :items => 'posts'),
- #'tags' => make_iterable(self.tags, :index => 'name', :items => 'posts')
- #})
- #payload
- #end
-
- #end
-#end