diff options
author | redmatrix <git@macgirvin.com> | 2016-04-30 15:02:45 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-30 15:02:45 -0700 |
commit | 84d93cca6e2ac0b552a6f5c570fbcfce766200a1 (patch) | |
tree | a8a9c46ee6f70dd4b8824499a49b1e39e2980dc6 /library/font_awesome/src/_plugins | |
parent | 45512e6aba602604143e946cca49c363ae88aa1e (diff) | |
parent | 9446d0cbb463af6a256efebf97e10618469f1193 (diff) | |
download | volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.tar.gz volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.tar.bz2 volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'library/font_awesome/src/_plugins')
-rw-r--r-- | library/font_awesome/src/_plugins/flatten_icon_filters.rb | 38 | ||||
-rw-r--r-- | library/font_awesome/src/_plugins/icon_page_generator.rb | 3 |
2 files changed, 39 insertions, 2 deletions
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 <Set> + 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 |