jekyll-attendease 0.9.5 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/jekyll/attendease_plugin/config_mixin.rb +4 -0
- data/lib/jekyll/attendease_plugin/site_page.rb +1 -0
- data/lib/jekyll/attendease_plugin/site_page_data.rb +106 -0
- data/lib/jekyll/attendease_plugin/site_pages_generator.rb +2 -78
- data/lib/jekyll/attendease_plugin/tags.rb +4 -2
- data/lib/jekyll/attendease_plugin/version.rb +1 -2
- data/lib/jekyll/attendease_plugin.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 999a2c4542a7a2bf28e57ac2615475b3d039f09df9a7da9058a16630f74a3425
|
4
|
+
data.tar.gz: 1517ab2468ea9b47fc37837a0c450ffbfb83391ff1c1855314e62c87c674cc7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5da335ad61308e783649ddade55747434a564ba68ceef1aa1d3f566afdeac4c44c9f44043b3cb7caa7d1f80c1e95ec13470ec6d02f851ae59853240e45089fc2
|
7
|
+
data.tar.gz: 0ded6a271d2cc4e303402a70856feadeac8e18dcd1d3adb4cb72d497d00ac7b64248c540d57d086184178a48fafbb48450d7663e9b6f5a5bf7df3931fe523d12
|
@@ -0,0 +1,106 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module AttendeasePlugin
|
3
|
+
class SitePageData < Page
|
4
|
+
attr_reader :page
|
5
|
+
attr_reader :site
|
6
|
+
|
7
|
+
PLACEHOLDER_REGEX = /\{\{/.freeze
|
8
|
+
|
9
|
+
def initialize(site, base, page, private_site)
|
10
|
+
@site = site
|
11
|
+
@base = base
|
12
|
+
@dir = page['slug']
|
13
|
+
@page = page
|
14
|
+
@name = "index#{private_site ? '-private' : ''}.json"
|
15
|
+
|
16
|
+
# The Jekyll::Regenerator expects data to exist and crashes without it.
|
17
|
+
# https://github.com/jekyll/jekyll/blob/v3.3.1/lib/jekyll/regenerator.rb#L166
|
18
|
+
@data = {}
|
19
|
+
|
20
|
+
self.process(@name)
|
21
|
+
end
|
22
|
+
|
23
|
+
def render_with_liquid?
|
24
|
+
false
|
25
|
+
end
|
26
|
+
|
27
|
+
def place_in_layout?
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
31
|
+
# Override the accessor:
|
32
|
+
#
|
33
|
+
# https://github.com/jekyll/jekyll/blob/v3.3.1/lib/jekyll/renderer.rb#L78
|
34
|
+
#
|
35
|
+
# The Jekyll::Rendereer calls document.content, so this seems like the
|
36
|
+
# best way to set our "page" content with what we want.
|
37
|
+
#
|
38
|
+
def content
|
39
|
+
zones = {}
|
40
|
+
keys = %w[content preferences]
|
41
|
+
|
42
|
+
if page['block_instances'].length
|
43
|
+
# create zone buckets
|
44
|
+
page['block_instances'].each do |i|
|
45
|
+
# go through all content
|
46
|
+
if site.config.event?
|
47
|
+
keys.each do |key|
|
48
|
+
i[key].each do |k, v|
|
49
|
+
if placeholder?(v)
|
50
|
+
# maintain the {{ t.foo }} variables
|
51
|
+
v.gsub!(/(\{\{\s*t\.[a-z_.]+\s*\}\})/, '{% raw %}\1{% endraw %}')
|
52
|
+
i[key][k] = render_with_substitutions(v, 'event' => site.data['event'], 'mappable' => site.data['mappable'])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
unless site.data['mappable'].nil? || site.data['mappable'].empty?
|
58
|
+
perform_substitution!(i, 'mappable' => site.data['mappable'])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
zones[i['zone']] = [] if zones[i['zone']].nil?
|
63
|
+
zones[i['zone']] << i
|
64
|
+
end
|
65
|
+
|
66
|
+
# sort each bucket by widget weight
|
67
|
+
zones.each do |k, zone|
|
68
|
+
zone.sort! { |x, y| x['weight'] <=> y['weight'] }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
zones.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def perform_substitution!(object, substitution_lookup)
|
78
|
+
if object.is_a?(Hash)
|
79
|
+
object.each_pair do |k, v|
|
80
|
+
if placeholder?(v)
|
81
|
+
object[k] = render_with_substitutions(v, substitution_lookup)
|
82
|
+
else
|
83
|
+
perform_substitution!(v, substitution_lookup)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
elsif object.is_a?(Array)
|
87
|
+
object.each_with_index do |e, i|
|
88
|
+
if placeholder?(e)
|
89
|
+
object[i] = render_with_substitutions(e, substitution_lookup)
|
90
|
+
else
|
91
|
+
perform_substitution!(e, substitution_lookup)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def placeholder?(object)
|
98
|
+
object.is_a?(String) && object =~ PLACEHOLDER_REGEX
|
99
|
+
end
|
100
|
+
|
101
|
+
def render_with_substitutions(template_string, substitution_lookup)
|
102
|
+
Liquid::Template.parse(template_string).render(substitution_lookup)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -2,8 +2,6 @@ module Jekyll
|
|
2
2
|
module AttendeasePlugin
|
3
3
|
class SitePagesGenerator < Generator
|
4
4
|
safe true
|
5
|
-
PLACEHOLDER_REGEX = /\{\{/.freeze
|
6
|
-
|
7
5
|
# site.config:
|
8
6
|
# Is where you can find the configs generated for your site
|
9
7
|
# To check the structure sample go in your vagrant to
|
@@ -14,86 +12,12 @@ module Jekyll
|
|
14
12
|
require 'cgi'
|
15
13
|
|
16
14
|
page['name'] = CGI.escapeHTML(page['name']) if page['name']
|
15
|
+
page['description'] = CGI.escapeHTML(page['description']) if page['description']
|
17
16
|
site.pages << SitePage.new(site, site.source, page)
|
18
|
-
|
19
|
-
zones = {}
|
20
|
-
keys = %w[content preferences]
|
21
|
-
|
22
|
-
if page['block_instances'].length
|
23
|
-
# create zone buckets
|
24
|
-
page['block_instances'].each do |i|
|
25
|
-
# go through all content
|
26
|
-
if site.config.event?
|
27
|
-
keys.each do |key|
|
28
|
-
i[key].each do |k, v|
|
29
|
-
if placeholder?(v)
|
30
|
-
# maintain the {{ t.foo }} variables
|
31
|
-
v.gsub!(/(\{\{\s*t\.[a-z_.]+\s*\}\})/, '{% raw %}\1{% endraw %}')
|
32
|
-
i[key][k] = render_with_substitutions(v, 'event' => site.data['event'], 'mappable' => site.data['mappable'])
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
unless site.data['mappable'].nil? || site.data['mappable'].empty?
|
38
|
-
perform_substitution!(i, 'mappable' => site.data['mappable'])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
zones[i['zone']] = [] if zones[i['zone']].nil?
|
43
|
-
zones[i['zone']] << i
|
44
|
-
end
|
45
|
-
|
46
|
-
# sort each bucket by widget weight
|
47
|
-
zones.each do |k, zone|
|
48
|
-
zone.sort! { |x, y| x['weight'] <=> y['weight'] }
|
49
|
-
end
|
50
|
-
|
51
|
-
page_source_path = File.join(site.source, page['slug'])
|
52
|
-
FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)
|
53
|
-
|
54
|
-
json_filename = site.config.attendease['private_site'] ? 'index-private.json' : 'index.json'
|
55
|
-
|
56
|
-
File.open(File.join(page_source_path, json_filename), 'w') do |f|
|
57
|
-
f.write zones.to_json
|
58
|
-
f.close
|
59
|
-
end
|
60
|
-
|
61
|
-
site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)
|
62
|
-
end
|
17
|
+
site.pages << SitePageData.new(site, site.source, page, site.config.private_site?)
|
63
18
|
end
|
64
19
|
end
|
65
20
|
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
|
96
21
|
end
|
97
22
|
end
|
98
23
|
end
|
99
|
-
|
@@ -183,7 +183,8 @@ module Jekyll
|
|
183
183
|
'pages' => pages,
|
184
184
|
'settings' => { parentPagesAreClickable: !!parent_pages_are_clickable },
|
185
185
|
'siteSettings' => site_settings,
|
186
|
-
'analytics' => analytics
|
186
|
+
'analytics' => analytics,
|
187
|
+
'basePath' => config['base_path']
|
187
188
|
}
|
188
189
|
else
|
189
190
|
constants = {
|
@@ -201,7 +202,8 @@ module Jekyll
|
|
201
202
|
'settings' => { parentPagesAreClickable: !!parent_pages_are_clickable },
|
202
203
|
'siteSettings' => site_settings,
|
203
204
|
'organizationSiteSettings' => organization_site_settings,
|
204
|
-
'analytics' => analytics
|
205
|
+
'analytics' => analytics,
|
206
|
+
'basePath' => config['base_path']
|
205
207
|
}
|
206
208
|
end
|
207
209
|
|
@@ -33,6 +33,7 @@ require 'jekyll/attendease_plugin/sponsors_index_page'
|
|
33
33
|
require 'jekyll/attendease_plugin/venues_index_page'
|
34
34
|
require 'jekyll/attendease_plugin/venue_page'
|
35
35
|
require 'jekyll/attendease_plugin/site_page'
|
36
|
+
require 'jekyll/attendease_plugin/site_page_data'
|
36
37
|
|
37
38
|
# Ve.rs.ion
|
38
39
|
require 'jekyll/attendease_plugin/version'
|
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.8
|
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:
|
15
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: httparty
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/jekyll/attendease_plugin/schedule_session_page.rb
|
185
185
|
- lib/jekyll/attendease_plugin/schedule_sessions_page.rb
|
186
186
|
- lib/jekyll/attendease_plugin/site_page.rb
|
187
|
+
- lib/jekyll/attendease_plugin/site_page_data.rb
|
187
188
|
- lib/jekyll/attendease_plugin/site_pages_generator.rb
|
188
189
|
- lib/jekyll/attendease_plugin/sponsor_generator.rb
|
189
190
|
- lib/jekyll/attendease_plugin/sponsors_index_page.rb
|
@@ -238,8 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
239
|
- !ruby/object:Gem::Version
|
239
240
|
version: '0'
|
240
241
|
requirements: []
|
241
|
-
|
242
|
-
rubygems_version: 2.6.14.4
|
242
|
+
rubygems_version: 3.0.3.1
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Attendease event helper for Jekyll
|