sutty-liquid 0.5.1 → 0.7.1
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/pry.rb +2 -0
- data/lib/jekyll/filters/social_network.rb +3 -1
- data/lib/jekyll/filters/strings.rb +27 -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: 71f4b369c3f6a7abf71811e1f5c9c95a69639c511507df0679b2a87bc2f84341
|
4
|
+
data.tar.gz: 4c86e2f9be638bd60a7f5a02cdfad76523e60fc07a98dd567da6950ebef6d1b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea1c1fe8c57294b6b954fea1021f3c62cff4697852a297d395403409e38432697fca55f35879bb0920ef2b218b087c75e8dfb66dc15146d8c8749e2ac9d8ed23
|
7
|
+
data.tar.gz: 5b5c622c4b38b24e44ae262d914affd3c0dd52554a17a1a926c5d036c526a12723063c448601556075661a3cdb84f0ee773ef2a43a063c15118e639656f61bd6
|
data/lib/jekyll/filters/pry.rb
CHANGED
@@ -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!
|
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)
|
data/lib/sutty-liquid.rb
CHANGED
@@ -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.
|
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:
|
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
|