jekyll-attendease 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/jekyll/attendease_plugin/_config.yaml +0 -1
- data/lib/jekyll/attendease_plugin/site_pages_generator.rb +38 -2
- data/lib/jekyll/attendease_plugin/version.rb +2 -1
- data/spec/lib/jekyll/attendease_plugin/site_pages_generator_spec.rb +8 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f34a3a54e23f0d3b76b52f58ab12428d001bb44f
|
4
|
+
data.tar.gz: 7ccb50dc81a6afa20724df44d60fdf2481603a66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2eafd219f7d4901da9cc9da5927385ee45ae83a298c920fb3b07285f5247d086e4ff5ae51e96e9c0b656bf2a53be4985a0ff3da5586a32b9679c450f474979e
|
7
|
+
data.tar.gz: 34457707f96c7b80acab36729f5ffc9a0b8b6203a16e4cf0cf5ba13e05aa539bb31c64136e92ee74650ad27eb583187cb6d57883bbe19c6feb852b057242e4df
|
@@ -2,6 +2,7 @@ module Jekyll
|
|
2
2
|
module AttendeasePlugin
|
3
3
|
class SitePagesGenerator < Generator
|
4
4
|
safe true
|
5
|
+
PLACEHOLDER_REGEX = /\{\{/.freeze
|
5
6
|
|
6
7
|
# site.config:
|
7
8
|
# Is where you can find the configs generated for your site
|
@@ -25,14 +26,19 @@ module Jekyll
|
|
25
26
|
if site.config.event?
|
26
27
|
keys.each do |key|
|
27
28
|
i[key].each do |k, v|
|
28
|
-
if
|
29
|
+
if placeholder?(v)
|
29
30
|
# maintain the {{ t.foo }} variables
|
30
31
|
v.gsub!(/(\{\{\s*t\.[a-z_.]+\s*\}\})/, '{% raw %}\1{% endraw %}')
|
31
|
-
i[key][k] =
|
32
|
+
i[key][k] = render_with_substitutions(v, 'event' => site.data['event'], 'mappable' => site.data['mappable'])
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
36
|
+
|
37
|
+
unless site.data['mappable'].nil? || site.data['mappable'].empty?
|
38
|
+
perform_substitution!(i, 'mappable' => site.data['mappable'])
|
39
|
+
end
|
35
40
|
end
|
41
|
+
|
36
42
|
zones[i['zone']] = [] if zones[i['zone']].nil?
|
37
43
|
zones[i['zone']] << i
|
38
44
|
end
|
@@ -57,6 +63,36 @@ module Jekyll
|
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def perform_substitution!(object, substitution_lookup)
|
70
|
+
if object.is_a?(Hash)
|
71
|
+
object.each_pair do |k, v|
|
72
|
+
if placeholder?(v)
|
73
|
+
object[k] = render_with_substitutions(v, substitution_lookup)
|
74
|
+
else
|
75
|
+
perform_substitution!(v, substitution_lookup)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
elsif object.is_a?(Array)
|
79
|
+
object.each_with_index do |e, i|
|
80
|
+
if placeholder?(e)
|
81
|
+
object[i] = render_with_substitutions(e, substitution_lookup)
|
82
|
+
else
|
83
|
+
perform_substitution!(e, substitution_lookup)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def placeholder?(object)
|
90
|
+
object.is_a?(String) && object =~ PLACEHOLDER_REGEX
|
91
|
+
end
|
92
|
+
|
93
|
+
def render_with_substitutions(template_string, substitution_lookup)
|
94
|
+
Liquid::Template.parse(template_string).render(substitution_lookup)
|
95
|
+
end
|
60
96
|
end
|
61
97
|
end
|
62
98
|
end
|
@@ -23,6 +23,14 @@ RSpec.describe Jekyll::AttendeasePlugin::SitePagesGenerator do
|
|
23
23
|
expect(File.exists?(file)).to eq(true)
|
24
24
|
expect(File.file?(file)).to eq(true)
|
25
25
|
end
|
26
|
+
|
27
|
+
it 'parses mappable placeholders' do
|
28
|
+
slug = page['slug']
|
29
|
+
file = File.join(site.config['destination'], slug, 'index.json')
|
30
|
+
json = JSON.parse(File.read(file))
|
31
|
+
expect(json['dropzone1'][0]['content']['text']).to eq('Hello world')
|
32
|
+
expect(json['dropzone1'][0]['preferences']['foo']).to eq('Hello world')
|
33
|
+
end
|
26
34
|
end
|
27
35
|
|
28
36
|
context 'page with XSS' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-attendease
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Wood
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2020-
|
15
|
+
date: 2020-04-01 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: httparty
|
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.6.14.4
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Attendease event helper for Jekyll
|