jekyll-svelte-slabs 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-svelte-slabs.rb +28 -0
- data/lib/jekyll-svelte-slabs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a4cdf5dc8a01e002345bb2d59e03da9c234648abb4aaa90766362f850e6bd7c
|
4
|
+
data.tar.gz: ab0981d0fb1899504f634d718918f09fbc4b174dae72b668cae7d930a8412d54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f53a642871ce00651d1d64d3d6f88b96a5ab7040b1471c8af52a2e51423c26547100e1892118694a8a946bfcc9d6054393b2fa405f5f1c7ec4e97ba09d3bd12b
|
7
|
+
data.tar.gz: a3011c2540a15fca0dd91fedebe940076a3eb0e480543f0a2c3068ac3921b7053450e8093e74e70e98653010392370e06904e6655af2eb686c6469b287f6a41a
|
data/lib/jekyll-svelte-slabs.rb
CHANGED
@@ -37,6 +37,32 @@ module JekyllSvelteSlabs
|
|
37
37
|
false
|
38
38
|
end
|
39
39
|
|
40
|
+
# Iterate a hash (incl. arrays) to delete named keys
|
41
|
+
def purge_keys_from_hash(params, keys)
|
42
|
+
params.each do |k,v|
|
43
|
+
value = v || k
|
44
|
+
|
45
|
+
if value.is_a?(Hash) || value.is_a?(Array)
|
46
|
+
purge_keys_from_hash(value, keys)
|
47
|
+
else
|
48
|
+
params.delete(k) if keys.include?(k)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Remove a bind if specified, as well as any keys listed in the site config
|
54
|
+
def clean_params(context, params)
|
55
|
+
params.delete('bind')
|
56
|
+
|
57
|
+
slab_config = context['site']['svelte_slabs']
|
58
|
+
return unless slab_config
|
59
|
+
|
60
|
+
purge_keys = slab_config['remove_keys']
|
61
|
+
unless purge_keys.nil?
|
62
|
+
purge_keys_from_hash(params, purge_keys)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
40
66
|
def parse_params(context)
|
41
67
|
params = {}
|
42
68
|
@params.scan(VALID_SYNTAX) do |key, d_quoted, s_quoted, variable|
|
@@ -59,6 +85,8 @@ module JekyllSvelteSlabs
|
|
59
85
|
end
|
60
86
|
end
|
61
87
|
|
88
|
+
clean_params(context, params)
|
89
|
+
|
62
90
|
params
|
63
91
|
end
|
64
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-svelte-slabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liam Bigelow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|