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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39eed3c72957a11917dd1a11c1ca18fa8ddcd94e4226ee917cef81891bcf5bfd
4
- data.tar.gz: 657bdf15735eb1e37edd604688e839d5b72da30f7053f43ed12fe8df472884f5
3
+ metadata.gz: 3a4cdf5dc8a01e002345bb2d59e03da9c234648abb4aaa90766362f850e6bd7c
4
+ data.tar.gz: ab0981d0fb1899504f634d718918f09fbc4b174dae72b668cae7d930a8412d54
5
5
  SHA512:
6
- metadata.gz: dbac3dc1d0aabc4507ed641984e4813f6bf97fe7d4009f806fc1b26879e77efe21fe7c3d8d65ad049780fa9df84dd4f245f45b6e19ceee22c7dee9d31d0dc9e6
7
- data.tar.gz: 91892c74507558e3fc24af3fd39827c91f49d15f50a6d8b4950376d70b8549fe366171e4376a2d780ce3506fa01fad8bc3fd3b03fa999d4bdd9dc816a6d12c87
6
+ metadata.gz: f53a642871ce00651d1d64d3d6f88b96a5ab7040b1471c8af52a2e51423c26547100e1892118694a8a946bfcc9d6054393b2fa405f5f1c7ec4e97ba09d3bd12b
7
+ data.tar.gz: a3011c2540a15fca0dd91fedebe940076a3eb0e480543f0a2c3068ac3921b7053450e8093e74e70e98653010392370e06904e6655af2eb686c6469b287f6a41a
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module JekyllSvelteSlabs
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-12 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll