sutty-liquid 0.7.0 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/filters/date_local.rb +4 -4
- data/lib/jekyll/filters/sample.rb +3 -2
- data/lib/jekyll/filters/social_network.rb +18 -10
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 217763268e487f10aec0b09212b07618f8a5ffedefd3afe52b8892462c616304
|
4
|
+
data.tar.gz: b1b4edef6669cf7388672c178f68463ca14492d1b306715280b85c3ecdb5bd19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8493787622d5f8bc8dcda86c9a3e57be96e4d8192f46235e0c3477d70262aa13e7f96fb0f5edaf94585d314eb0d6196851fb44edab8a09ef1eab45912efbd7d0
|
7
|
+
data.tar.gz: 517de2fa67d73f37583a1ba38baea81cca79eb31e96988a260f217eb4a86e726b54ea5f8622d93689c52714306dd06aea6e81831c3d2cff40dc1498b66393c72
|
@@ -11,20 +11,20 @@ module Jekyll
|
|
11
11
|
# {{ page.date | date_local: '%e de %B de %Y' }}
|
12
12
|
#
|
13
13
|
# @see {_data/es.yml}
|
14
|
-
# @param [String|Date]
|
14
|
+
# @param [String|Date|Time|DateTime]
|
15
15
|
# @param [String]
|
16
16
|
# @return [String]
|
17
17
|
def date_local(input, format)
|
18
18
|
require 'date'
|
19
19
|
|
20
|
-
input =
|
20
|
+
input = ::Jekyll::Utils.parse_date(input) unless input.respond_to? :mon
|
21
21
|
|
22
22
|
# Return early if we don't need to translate
|
23
23
|
return input.strftime(format) unless /%(|\^)[aAbBpP]/ =~ format
|
24
24
|
|
25
25
|
input.strftime translate_localization_format(input, format)
|
26
|
-
rescue ArgumentError
|
27
|
-
Jekyll.logger.warn "#{input} is not a valid
|
26
|
+
rescue ArgumentError, TypeError, ::Jekyll::Errors::InvalidDateError => e
|
27
|
+
Jekyll.logger.warn "#{input} is not a valid date: #{e.message}"
|
28
28
|
input
|
29
29
|
end
|
30
30
|
|
@@ -8,13 +8,14 @@ module Jekyll
|
|
8
8
|
# Example usage:
|
9
9
|
#
|
10
10
|
# {{ site.posts | sample }}
|
11
|
+
# {{ site.posts | sample: 3 }}
|
11
12
|
#
|
12
13
|
# @input [Array]
|
13
14
|
# @return [Any]
|
14
|
-
def sample(input)
|
15
|
+
def sample(input, amount = 1)
|
15
16
|
return unless input.respond_to? :sample
|
16
17
|
|
17
|
-
input.sample
|
18
|
+
input.sample(amount)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -3,6 +3,11 @@
|
|
3
3
|
module Jekyll
|
4
4
|
module Filters
|
5
5
|
module SocialNetwork
|
6
|
+
SUBDOMAINS = /\A(www|chat)\./.freeze
|
7
|
+
DOMAIN_MAP = {
|
8
|
+
't.me' => 'telegram'
|
9
|
+
}.freeze
|
10
|
+
|
6
11
|
# Takes a URL and returns a Hash of attributes, useful when you
|
7
12
|
# want to generate social network buttons from an undetermined
|
8
13
|
# list of URLs.
|
@@ -19,19 +24,22 @@ module Jekyll
|
|
19
24
|
# @param [String]
|
20
25
|
# @return [Hash]
|
21
26
|
def social_network(url)
|
22
|
-
|
23
|
-
|
24
|
-
require 'uri'
|
27
|
+
begin
|
28
|
+
require 'uri'
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
name = %r{/@\w+} =~ uri.query ? 'mastodon' : uri.host.split('.', 2).first
|
30
|
+
uri = URI url
|
31
|
+
host = uri.host.sub SUBDOMAINS, ''
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
+
name = DOMAIN_MAP[host]
|
34
|
+
name ||= %r{/@\w+} =~ uri.query ? 'mastodon' : host.split('.', 2).first
|
35
|
+
rescue ArgumentError, URI::InvalidURIError => e
|
36
|
+
Jekyll.logger.warn(e.message) if Jekyll.respond_to?(:logger)
|
37
|
+
ensure
|
38
|
+
host ||= url
|
39
|
+
name ||= 'globe'
|
40
|
+
end
|
33
41
|
|
34
|
-
{}.to_liquid
|
42
|
+
{ 'host' => host, 'name' => name, 'url' => url }.to_liquid
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
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.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -38,6 +38,48 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.13'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.13'
|
41
83
|
description: An assorment of Liquid filters and tags for Jekyll used in Sutty
|
42
84
|
email:
|
43
85
|
- f@sutty.nl
|