jekyll-svelte-slabs 0.0.3 → 0.0.9

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: 3a4cdf5dc8a01e002345bb2d59e03da9c234648abb4aaa90766362f850e6bd7c
4
- data.tar.gz: ab0981d0fb1899504f634d718918f09fbc4b174dae72b668cae7d930a8412d54
3
+ metadata.gz: 818e79cd8d46137674065528c13804a6e61fb69c7d4692ade5a2a6bdc3967852
4
+ data.tar.gz: 534fbc054a20dff22fa1245dcee8a0def5192ded08dec608d6cabed346faca37
5
5
  SHA512:
6
- metadata.gz: f53a642871ce00651d1d64d3d6f88b96a5ab7040b1471c8af52a2e51423c26547100e1892118694a8a946bfcc9d6054393b2fa405f5f1c7ec4e97ba09d3bd12b
7
- data.tar.gz: a3011c2540a15fca0dd91fedebe940076a3eb0e480543f0a2c3068ac3921b7053450e8093e74e70e98653010392370e06904e6655af2eb686c6469b287f6a41a
6
+ metadata.gz: 79bc5003e67d9e87e3872dd2f8210fddaf2ddddf97b11322d75ab462d36c78556396826e80c0e19851f7b4acf129e709798f04e2b82144f2217b291cfec461f8
7
+ data.tar.gz: bac95eaf40177654712fb999eacd9d59325f934a5a01a526066d80ce1a0dd97d02f6bf8803cd01aeefeef608c549d8069082d4cd677b384240426c16b13ab639
@@ -73,6 +73,12 @@ module JekyllSvelteSlabs
73
73
  elsif variable
74
74
  context[variable]
75
75
  end
76
+
77
+ # Turn arrays of Documents into arrays of DocumentDrops
78
+ # so that the to_json in render pulls the hash not the content
79
+ if value.class == Array
80
+ value = value.map {|v| v.class == Jekyll::Document ? v.to_liquid : v}
81
+ end
76
82
 
77
83
  params[key] = value
78
84
  end
@@ -129,10 +135,15 @@ module JekyllSvelteSlabs
129
135
  # site = context.registers[:site]
130
136
  # puts site
131
137
 
138
+ slab_config = context['site']['svelte_slabs'] || {}
139
+ method = slab_config['method'] || "window"
140
+
132
141
  file = render_variable(context) || @file
133
142
  validate_file_name(file)
134
143
 
135
144
  svelte_data = @params ? parse_params(context).to_json : "{}"
145
+ svelte_data = "\"#{Base64.strict_encode64(svelte_data)}\"" if method == "window_b"
146
+ svelte_data = "\"#{svelte_data.gsub("<", "&rawlt;")}\"" if method == "window_e"
136
147
  endpoint = Digest::MD5.hexdigest(svelte_data)
137
148
 
138
149
  <<~MSG
@@ -140,7 +151,7 @@ module JekyllSvelteSlabs
140
151
  window.svelteSlabs = window.svelteSlabs || {};
141
152
  window.svelteSlabs["#{endpoint}"] = #{svelte_data};
142
153
  </script>
143
- <div data-svelte-slab="#{file}" data-svelte-slab-props="window:#{endpoint}">
154
+ <div data-svelte-slab="#{file}" data-svelte-slab-props="#{method}:#{endpoint}">
144
155
  #{text}
145
156
  </div>
146
157
  MSG
@@ -1,3 +1,3 @@
1
1
  module JekyllSvelteSlabs
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.9"
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.3
4
+ version: 0.0.9
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-12-08 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll