sutty-liquid 0.5.1 → 0.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c72d9f508299076408aafbf0aa0e75f128259b3f647b16951f4f0b3ec18233a
4
- data.tar.gz: 6c3216caa9bf468ea6375badf89cc33eef090ce41e98c8f0f9b7c492a28626d3
3
+ metadata.gz: 71f4b369c3f6a7abf71811e1f5c9c95a69639c511507df0679b2a87bc2f84341
4
+ data.tar.gz: 4c86e2f9be638bd60a7f5a02cdfad76523e60fc07a98dd567da6950ebef6d1b3
5
5
  SHA512:
6
- metadata.gz: 7215373c2ff717d19d0b6593f2e938c153c2f2c7825928b9f8a88d416e61a7624e09fbcfc55f83e62859481231ae3700f7aae7a03d184e880e037d5c0362d35a
7
- data.tar.gz: 414606c886d9e4313d405e95664ad8e108a562bb9a60490abf1f5042edb0df32533f5e30f97b1559fbe31cc55c33aca6bbfaa92e4b2ba40a0f0366a1f41b1565
6
+ metadata.gz: ea1c1fe8c57294b6b954fea1021f3c62cff4697852a297d395403409e38432697fca55f35879bb0920ef2b218b087c75e8dfb66dc15146d8c8749e2ac9d8ed23
7
+ data.tar.gz: 5b5c622c4b38b24e44ae262d914affd3c0dd52554a17a1a926c5d036c526a12723063c448601556075661a3cdb84f0ee773ef2a43a063c15118e639656f61bd6
@@ -12,6 +12,8 @@ module Jekyll
12
12
  require 'pry'
13
13
 
14
14
  binding.pry
15
+
16
+ input
15
17
  end
16
18
  end
17
19
  end
@@ -3,6 +3,8 @@
3
3
  module Jekyll
4
4
  module Filters
5
5
  module SocialNetwork
6
+ SUBDOMAINS = /\A(www|chat)\./.freeze
7
+
6
8
  # Takes a URL and returns a Hash of attributes, useful when you
7
9
  # want to generate social network buttons from an undetermined
8
10
  # list of URLs.
@@ -24,7 +26,7 @@ module Jekyll
24
26
  require 'uri'
25
27
 
26
28
  uri = URI url
27
- uri.host.sub! 'www.', ''
29
+ uri.host.sub! SUBDOMAINS, ''
28
30
  name = %r{/@\w+} =~ uri.query ? 'mastodon' : uri.host.split('.', 2).first
29
31
 
30
32
  { 'host' => uri.host, 'name' => name, 'url' => url }.to_liquid
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Filters
5
+ module Strings
6
+ # String#start_with?
7
+ def start_with(input, start)
8
+ input.to_s.start_with? start.to_s
9
+ end
10
+
11
+ # Replaces the last ocurrence of a String
12
+ #
13
+ # @param [String]
14
+ # @param [String]
15
+ # @param [String]
16
+ # @return [String]
17
+ def replace_last(input, search, replace)
18
+ hay = input.split search
19
+ needle = "#{replace}#{hay.pop}"
20
+
21
+ hay.join(search) + needle
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ Liquid::Template.register_filter(Jekyll::Filters::Strings)
@@ -9,6 +9,7 @@ require_relative 'jekyll/filters/json'
9
9
  require_relative 'jekyll/filters/menu'
10
10
  require_relative 'jekyll/filters/number'
11
11
  require_relative 'jekyll/filters/sample'
12
+ require_relative 'jekyll/filters/strings'
12
13
  require_relative 'jekyll/filters/social_network'
13
14
 
14
15
  require_relative 'jekyll/filters/pry'
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.5.1
4
+ version: 0.7.1
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-11 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -61,6 +61,7 @@ files:
61
61
  - lib/jekyll/filters/pry.rb
62
62
  - lib/jekyll/filters/sample.rb
63
63
  - lib/jekyll/filters/social_network.rb
64
+ - lib/jekyll/filters/strings.rb
64
65
  - lib/jekyll/tags/pry.rb
65
66
  - lib/sutty-liquid.rb
66
67
  homepage: https://0xacab.org/sutty/jekyll/sutty-liquid