unignore bower_components
[bootswatch] / bower_components / font-awesome / src / _plugins / icon_page_generator.rb
1 ##
2 # Create individual pages for each icon in the FontAwesome set
3
4 require 'yaml'
5 require 'debugger'
6
7 module Jekyll
8
9   class IconPage < Page
10
11     ##
12     # Take a single icon and render a page for it.
13
14     def initialize(site, base, dir, icon)
15       @site = site
16       @base = base
17       @dir = dir
18       @name = "#{icon.id}.html"
19       @icon = icon
20
21       self.process(@name)
22
23       self.read_yaml(File.join(base, site.config['layouts']), site.config['icon_layout'])
24
25       self.data['icon'] = icon
26       self.data['title'] = "icon-#{icon.id}: " + self.data['title_suffix']
27     end
28
29   end
30
31   class IconGenerator < Generator
32
33     ##
34     # Iterate over every described icon in a YAML file and create a page for it
35
36     safe true
37
38     def generate(site)
39       site.icons.each do |icon|
40         site.pages << IconPage.new(site, site.source, site.config['icon_destination'], icon)
41       end
42     end
43
44   end
45
46 end