aboutsummaryrefslogtreecommitdiff
path: root/themes/docsy/assets/vendor/forkawesome/src/doc/_plugins/flatten_icon_filters.rb
diff options
context:
space:
mode:
authorThijs Paelman <thijs.paelman+git@hotmail.be>2023-06-02 23:47:20 +0200
committerThijs Paelman <thijs.paelman+git@hotmail.be>2023-06-02 23:47:20 +0200
commit9af8ec61bb78b60a83fce241ef0e5f485dcfda28 (patch)
tree9d4305aeccf27d3324769879a1ac3bc17fe4426b /themes/docsy/assets/vendor/forkawesome/src/doc/_plugins/flatten_icon_filters.rb
parentd7f7c4b20cabb32bde00ff0e2fe9685ba041f3ab (diff)
downloadwebsite-9af8ec61bb78b60a83fce241ef0e5f485dcfda28.tar.gz
website-9af8ec61bb78b60a83fce241ef0e5f485dcfda28.zip
Add Matrix socials & fix typo
Add Matrix social element, by installing an extra font. It was pretty painful to install, and has some impact on all css-styles that start with the '.fa' class, due to global namespacing in scss (by using @import)
Diffstat (limited to 'themes/docsy/assets/vendor/forkawesome/src/doc/_plugins/flatten_icon_filters.rb')
-rw-r--r--themes/docsy/assets/vendor/forkawesome/src/doc/_plugins/flatten_icon_filters.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/themes/docsy/assets/vendor/forkawesome/src/doc/_plugins/flatten_icon_filters.rb b/themes/docsy/assets/vendor/forkawesome/src/doc/_plugins/flatten_icon_filters.rb
new file mode 100644
index 0000000..1e3daff
--- /dev/null
+++ b/themes/docsy/assets/vendor/forkawesome/src/doc/_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)