2013-05-03 00:12:33 +00:00
|
|
|
##
|
|
|
|
# Create individual pages for each icon in the FontAwesome set
|
|
|
|
|
|
|
|
require 'yaml'
|
2013-05-17 13:35:23 +00:00
|
|
|
require 'debugger'
|
2013-05-03 00:12:33 +00:00
|
|
|
|
|
|
|
module Jekyll
|
|
|
|
|
|
|
|
class IconPage < Page
|
|
|
|
|
|
|
|
##
|
|
|
|
# Take a single icon and render a page for it.
|
|
|
|
|
|
|
|
def initialize(site, base, dir, icon)
|
|
|
|
@site = site
|
|
|
|
@base = base
|
|
|
|
@dir = dir
|
2013-05-17 13:35:23 +00:00
|
|
|
@name = "#{icon.id}.html"
|
2013-05-03 00:12:33 +00:00
|
|
|
@icon = icon
|
|
|
|
|
|
|
|
self.process(@name)
|
|
|
|
|
|
|
|
self.read_yaml(File.join(base, site.config['layouts']), site.config['icon_layout'])
|
|
|
|
|
|
|
|
self.data['icon'] = icon
|
2013-05-17 13:35:23 +00:00
|
|
|
self.data['title'] = "icon-#{icon.id}: " + self.data['title_suffix']
|
2013-05-03 00:12:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class IconGenerator < Generator
|
|
|
|
|
|
|
|
##
|
|
|
|
# Iterate over every described icon in a YAML file and create a page for it
|
|
|
|
|
|
|
|
safe true
|
|
|
|
|
|
|
|
def generate(site)
|
2013-05-17 13:35:23 +00:00
|
|
|
site.icons.each do |icon|
|
2013-05-03 00:12:33 +00:00
|
|
|
site.pages << IconPage.new(site, site.source, site.config['icon_destination'], icon)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|