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 +4 -4
- data/lib/jekyll-svelte-slabs.rb +12 -1
- 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: 818e79cd8d46137674065528c13804a6e61fb69c7d4692ade5a2a6bdc3967852
|
4
|
+
data.tar.gz: 534fbc054a20dff22fa1245dcee8a0def5192ded08dec608d6cabed346faca37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79bc5003e67d9e87e3872dd2f8210fddaf2ddddf97b11322d75ab462d36c78556396826e80c0e19851f7b4acf129e709798f04e2b82144f2217b291cfec461f8
|
7
|
+
data.tar.gz: bac95eaf40177654712fb999eacd9d59325f934a5a01a526066d80ce1a0dd97d02f6bf8803cd01aeefeef608c549d8069082d4cd677b384240426c16b13ab639
|
data/lib/jekyll-svelte-slabs.rb
CHANGED
@@ -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="
|
154
|
+
<div data-svelte-slab="#{file}" data-svelte-slab-props="#{method}:#{endpoint}">
|
144
155
|
#{text}
|
145
156
|
</div>
|
146
157
|
MSG
|
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.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:
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|