summaryrefslogtreecommitdiff
path: root/live/static/fork-awesome/src/doc/_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'live/static/fork-awesome/src/doc/_plugins')
-rw-r--r--live/static/fork-awesome/src/doc/_plugins/all-contributors-generator.rb17
-rw-r--r--live/static/fork-awesome/src/doc/_plugins/flatten_icon_filters.rb38
-rw-r--r--live/static/fork-awesome/src/doc/_plugins/icon_page_generator.rb45
-rw-r--r--live/static/fork-awesome/src/doc/_plugins/site.rb142
-rw-r--r--live/static/fork-awesome/src/doc/_plugins/sri_hash.rb20
5 files changed, 0 insertions, 262 deletions
diff --git a/live/static/fork-awesome/src/doc/_plugins/all-contributors-generator.rb b/live/static/fork-awesome/src/doc/_plugins/all-contributors-generator.rb
deleted file mode 100644
index 85d0328..0000000
--- a/live/static/fork-awesome/src/doc/_plugins/all-contributors-generator.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-##
-# Generate an all-contributors badge with the number of contributors
-
-require "json"
-
-module Jekyll
- class AllContributors < Generator
- def generate(site)
- all_contributors_rc = File.read(File.join(Dir.pwd, '.all-contributorsrc'))
- all_contributors = JSON.parse(all_contributors_rc)
- total_contributors = all_contributors['contributors'].length
- site.pages.each do |page|
- page.data['total_contributors'] = total_contributors
- end
- end
- end
-end
diff --git a/live/static/fork-awesome/src/doc/_plugins/flatten_icon_filters.rb b/live/static/fork-awesome/src/doc/_plugins/flatten_icon_filters.rb
deleted file mode 100644
index 1e3daff..0000000
--- a/live/static/fork-awesome/src/doc/_plugins/flatten_icon_filters.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-##
-# Flattens the icons object to a one-dimensional array of possible search terms.
-
-require 'set'
-
-module Jekyll
- module FlattenArray
- def flattenIconFilters(icons)
- flattened = Set.new
- icons.each do |icon|
- toAdd = []
-
- toAdd.push(icon["class"].downcase) # Add class as a filter value
-
- # Add any existing aliases as a filter value
- if not icon["aliases"].nil?
- icon["aliases"].each do |iconAlias|
- toAdd.push(iconAlias.downcase)
- end
- end
-
- # Add any existing filters as a filter value
- if not icon["filter"].nil?
- icon["filter"].each do |iconFilter|
- toAdd.push(iconFilter.downcase)
- end
- end
- flattened.merge(toAdd)
-
- print toAdd if toAdd.include? true
- print toAdd if toAdd.include? false
- end
- return flattened.to_a # .to_a because we can't jsonify a <Set>
- end
- end
-end
-
-Liquid::Template.register_filter(Jekyll::FlattenArray)
diff --git a/live/static/fork-awesome/src/doc/_plugins/icon_page_generator.rb b/live/static/fork-awesome/src/doc/_plugins/icon_page_generator.rb
deleted file mode 100644
index 0daadf3..0000000
--- a/live/static/fork-awesome/src/doc/_plugins/icon_page_generator.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-##
-# Create individual pages for each icon in the FontAwesome set
-
-require 'yaml'
-
-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
- @name = "#{icon.id}.html"
- @icon = icon
-
- self.process(@name)
-
- self.read_yaml(File.join(base, site.config['layouts_dir']), site.config['icon_layout'])
-
- self.data['icon'] = icon
- self.data['title'] = "fa-#{icon.id}: " + self.data['title_suffix']
- 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)
- site.icons.each do |icon|
- site.pages << IconPage.new(site, site.source, site.config['icon_destination'], icon)
- end
- end
-
- end
-
-end
diff --git a/live/static/fork-awesome/src/doc/_plugins/site.rb b/live/static/fork-awesome/src/doc/_plugins/site.rb
deleted file mode 100644
index 0784d0d..0000000
--- a/live/static/fork-awesome/src/doc/_plugins/site.rb
+++ /dev/null
@@ -1,142 +0,0 @@
-##
-# Provide an icons attribute on the site object
-
-require 'yaml'
-require 'forwardable'
-
-module Jekyll
-
- class Icon
-
- attr_reader :name, :id, :unicode, :created, :categories
-
- def initialize(icon_object)
- @icon_object = icon_object
-
- # Class name used in CSS and HTML
- @icon_object['class'] = icon_object['id']
- # Normalize the aliases
- @icon_object['aliases'] ||= []
-
- @name = icon_object['name']
- @id = icon_object['id']
- @class = icon_object['class']
- @aliases = icon_object['aliases']
- @unicode = icon_object['unicode']
- @created = icon_object['created']
- @categories = icon_object['categories']
- end
-
- def to_liquid
- return @icon_object
- end
-
- end
-
- class IconList
- ##
- # A list of icons
- #
- include Enumerable
- extend Forwardable
-
- def_delegators :@icon_array, :each, :<<
-
- def initialize(icon_array)
- @original_icon_array = icon_array
- @icon_array = []
-
- icon_array.each { |icon_object|
- @icon_array << Icon.new(icon_object)
- }
- end
-
- def [](k)
- @icon_array[k]
- end
-
- def to_liquid
- @original_icon_array
- end
-
- end
-
- module IconFilters
- def expand_aliases(icons)
- expanded = []
-
- icons.each { |icon|
- # Remove the aliases since we are expanding them
- expanded << icon.reject{ |k| k == 'aliases'}
-
- icon['aliases'].each { |alias_id|
- alias_icon = expanded[-1].dup
- alias_icon['class'] = alias_id
- alias_icon['alias_of'] = icon
-
- expanded << alias_icon
- }
- }
-
- return expanded
- end
-
- def category(icons, cat)
- icons.select { |icon| icon['categories'].include?(cat) }
- end
-
- def version(icons, version)
- icons.select { |icon| icon['created'] == version }
- end
-
- def sort_by(icons, sort_key)
- icons.sort_by! { |icon| icon[sort_key] }
- end
- end
-
- Liquid::Template.register_filter(IconFilters)
-
- class Site
-
- attr_reader :icons
-
- def process
- self.reset_icons
- self.reset
- self.read
- self.generate
- self.render
- self.cleanup
- self.write
-
- self.build
- end
-
- ##
- # Reads the YAML file that stores all data about icons
- def reset_icons
- @icons = IconList.new(YAML.load_file(self.config['icon_meta'])['icons'])
- end
-
- ##
- # After generation, runs a build of Font-Awesome
- def build
- system("make build", :chdir => self.config['destination'], :out => :err)
- end
-
- def site_payload
- {
- "site" => self.config.merge({
- "time" => self.time,
- "posts" => self.posts.docs.sort { |a, b| b <=> a },
- "pages" => self.pages,
- "html_pages" => self.pages.reject { |page| !page.html? },
- "categories" => post_attr_hash('categories'),
- "tags" => post_attr_hash('tags')}),
- "icons" => @icons,
- }
- end
-
- end
-
-end
diff --git a/live/static/fork-awesome/src/doc/_plugins/sri_hash.rb b/live/static/fork-awesome/src/doc/_plugins/sri_hash.rb
deleted file mode 100644
index 63e0242..0000000
--- a/live/static/fork-awesome/src/doc/_plugins/sri_hash.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-##
-# Generate an SRI hash for a given file
-
-require 'digest'
-
-module Jekyll
- class GetSriHash < Liquid::Tag
- def initialize(tag_name, text, tokens)
- super
- @filename = text.strip
- end
-
- def render(context)
- sha256 = Digest::SHA256.file(@filename)
- "sha256-#{sha256.base64digest}"
- end
- end
-end
-
-Liquid::Template.register_tag('sri_hash', Jekyll::GetSriHash)