jekyll-filter-by_tag 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/jekyll-filter-by_tag.rb +25 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d759a372522a40ec8c7010e61de6ac1cb22a7b6
|
4
|
+
data.tar.gz: e1b9ccc8f3103631acf4be4e2cadf2d8a36623d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c2dd034ab56b7c0eecc195c513834a0548579f1753c607b77ee213302fa7b679c49b87b3657283a959b8bda35fa02e4d8c108e1af29df6fdec871e85a5056cdf
|
7
|
+
data.tar.gz: 3d087ac2fe1cdb529da37568f851fb341871e5f53bfed9e42220646a83856715b54e3d90d9bb6ccef27ba7c63aca70173eeec01ecde8eaf45be3636c9895d6ae
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module TagFilter
|
3
|
+
def by_tag(collection, tag)
|
4
|
+
new_collection = []
|
5
|
+
if !collection.kind_of?(Array)
|
6
|
+
raise TypeError, "You can only use this filter on an Array"
|
7
|
+
end
|
8
|
+
# puts tag
|
9
|
+
if tag
|
10
|
+
collection.each do |item|
|
11
|
+
# puts item['tags'].inspect
|
12
|
+
if ( item['tags'].kind_of?(String) && item['tags'] == '*' ) ||
|
13
|
+
( item['tags'].kind_of?(Array) && item['tags'].include?(tag) )
|
14
|
+
# puts "match found for #{tag}"
|
15
|
+
new_collection << item
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
# puts new_collection.inspect
|
20
|
+
return new_collection
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Liquid::Template.register_filter(Jekyll::TagFilter)
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-filter-by_tag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aaron Gustafson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: " This filter can be used on collections to extract only the items with\n
|
14
|
+
\ a `tags` property containing either the string \"*\" or an array \n containing
|
15
|
+
the aupplied argument. For example:\n\n \t{% assign resources = site.data.resources
|
16
|
+
| by_tag:\"development\" %}\n\n"
|
17
|
+
email: aaron@easy-designs.net
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/jekyll-filter-by_tag.rb
|
23
|
+
homepage: http://rubygems.org/gems/jekyll-filter-by_tag
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.5.1
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: Crosspost to Medium Generator for Jekyll
|
47
|
+
test_files: []
|