From 45654ffc5cc4532c2189c88d46a0374038b53c9f Mon Sep 17 00:00:00 2001 From: Treer Date: Sat, 30 Apr 2016 21:36:19 +1000 Subject: update font-awesome library to 4.6.1 Perhaps this should be done as a submodule instead? --- .../src/_plugins/flatten_icon_filters.rb | 38 ++++++++++++++++++++++ .../src/_plugins/icon_page_generator.rb | 3 +- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 library/font_awesome/src/_plugins/flatten_icon_filters.rb (limited to 'library/font_awesome/src/_plugins') diff --git a/library/font_awesome/src/_plugins/flatten_icon_filters.rb b/library/font_awesome/src/_plugins/flatten_icon_filters.rb new file mode 100644 index 000000000..1e3daff80 --- /dev/null +++ b/library/font_awesome/src/_plugins/flatten_icon_filters.rb @@ -0,0 +1,38 @@ +## +# 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 + end + end +end + +Liquid::Template.register_filter(Jekyll::FlattenArray) diff --git a/library/font_awesome/src/_plugins/icon_page_generator.rb b/library/font_awesome/src/_plugins/icon_page_generator.rb index 51475e540..32b7cd428 100644 --- a/library/font_awesome/src/_plugins/icon_page_generator.rb +++ b/library/font_awesome/src/_plugins/icon_page_generator.rb @@ -2,7 +2,6 @@ # Create individual pages for each icon in the FontAwesome set require 'yaml' -require 'debugger' module Jekyll @@ -23,7 +22,7 @@ module Jekyll self.read_yaml(File.join(base, site.config['layouts']), site.config['icon_layout']) self.data['icon'] = icon - self.data['title'] = "icon-#{icon.id}: " + self.data['title_suffix'] + self.data['title'] = "fa-#{icon.id}: " + self.data['title_suffix'] end end -- cgit v1.2.3