sutty-liquid 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jekyll/filters/assertion.rb +47 -0
- data/lib/jekyll/filters/compact.rb +4 -0
- data/lib/jekyll/filters/date_local.rb +6 -1
- data/lib/jekyll/filters/file.rb +5 -1
- data/lib/jekyll/filters/json.rb +2 -1
- data/lib/jekyll/filters/number.rb +4 -0
- data/lib/jekyll/filters/pry.rb +4 -0
- data/lib/jekyll/filters/sample.rb +5 -1
- data/lib/jekyll/filters/social_network.rb +9 -0
- data/lib/jekyll/tags/pry.rb +4 -0
- data/lib/sutty-liquid.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01c1a35c0761f6c17219e3e9a06ddb2b949bf3b1433787700ade08620a55f49b
|
4
|
+
data.tar.gz: fc671ef7716697be23407fd269647f7b8b49973c6576d6c5d2a9b0007779d014
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46fa3a15890cdf1dcada8d15d339b2bd42aa1d36d87fff009da40662400779ba5e31c3af853717c75a838f7ad712a9e5b8d487cc58048ee6636473d70a257884
|
7
|
+
data.tar.gz: 6fdb47629110a3548141995992c7cf9392d7e4e214efb37921ba422aa72af4303f7e13f88319b115bd852e4af12f1e7e8c086ba074f89e8f53dae63a5648a940
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Filters
|
5
|
+
module Assertion
|
6
|
+
# Compares two values.
|
7
|
+
#
|
8
|
+
# Example usage:
|
9
|
+
#
|
10
|
+
# {{ item.url | equals: page.url }}
|
11
|
+
#
|
12
|
+
# @param [Any]
|
13
|
+
# @param [Any]
|
14
|
+
# @return [TrueClass|FalseClass]
|
15
|
+
def equals(input, comparison)
|
16
|
+
input == comparison
|
17
|
+
end
|
18
|
+
|
19
|
+
# Ternary operator. If the input value is truthy, return first
|
20
|
+
# argument, otherwise returns the last.
|
21
|
+
#
|
22
|
+
# Example usage:
|
23
|
+
#
|
24
|
+
# {% assign active = item.url | equals: page.url %}
|
25
|
+
# {{ active | ternary: 'active', '' }}
|
26
|
+
#
|
27
|
+
# @param [Any]
|
28
|
+
# @param [Any]
|
29
|
+
# @param [Any]
|
30
|
+
# @return [Any]
|
31
|
+
def ternary(input, value, alternative)
|
32
|
+
empty = case input
|
33
|
+
when Integer then input.zero?
|
34
|
+
when Float then input.zero?
|
35
|
+
when TrueClass then input
|
36
|
+
when FalseClass then input
|
37
|
+
when NilClass then false
|
38
|
+
else input.empty?
|
39
|
+
end
|
40
|
+
|
41
|
+
(empty || !!input) ? value : alternative
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Liquid::Template.register_filter(Jekyll::Filters::Assertion)
|
@@ -3,7 +3,12 @@
|
|
3
3
|
module Jekyll
|
4
4
|
module Filters
|
5
5
|
module DateLocal
|
6
|
-
# Translates month and day names. This requires certain values on
|
6
|
+
# Translates month and day names. This requires certain values on
|
7
|
+
# your _data/LANG.yml
|
8
|
+
#
|
9
|
+
# Example usage:
|
10
|
+
#
|
11
|
+
# {{ page.date | date_local: '%e de %B de %Y' }}
|
7
12
|
#
|
8
13
|
# @see {_data/es.yml}
|
9
14
|
# @param [String|Date]
|
data/lib/jekyll/filters/file.rb
CHANGED
data/lib/jekyll/filters/json.rb
CHANGED
data/lib/jekyll/filters/pry.rb
CHANGED
@@ -7,6 +7,15 @@ module Jekyll
|
|
7
7
|
# want to generate social network buttons from an undetermined
|
8
8
|
# list of URLs.
|
9
9
|
#
|
10
|
+
# Example usage:
|
11
|
+
#
|
12
|
+
# {% assign mastodon = 'https://todon.nl/@sutty' | social_network %}
|
13
|
+
# <a href="{{ mastodon.url }}">
|
14
|
+
# <i class="fa-{{ mastodon.name }}"></i>
|
15
|
+
#
|
16
|
+
# {{ mastodon.name | capitalize }}
|
17
|
+
# </a>
|
18
|
+
#
|
10
19
|
# @param [String]
|
11
20
|
# @return [Hash]
|
12
21
|
def social_network(url)
|
data/lib/jekyll/tags/pry.rb
CHANGED
data/lib/sutty-liquid.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sutty-liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -35,6 +35,7 @@ extra_rdoc_files:
|
|
35
35
|
files:
|
36
36
|
- LICENSE.txt
|
37
37
|
- README.md
|
38
|
+
- lib/jekyll/filters/assertion.rb
|
38
39
|
- lib/jekyll/filters/compact.rb
|
39
40
|
- lib/jekyll/filters/date_local.rb
|
40
41
|
- lib/jekyll/filters/file.rb
|