jekyll-attendease 0.9.6 → 0.9.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a6d2a59f330d1e40082dc6c2894f1662e024c31c
4
- data.tar.gz: c32997bd96d2f403625ed705536095e47020f62b
2
+ SHA256:
3
+ metadata.gz: 33f0d8269012e6dfe7ae1cc23668d94f34fd14fcf763a2ffca96e7ad7c5d343d
4
+ data.tar.gz: 33bed60aac1bd35ac7b90bf97147b7e9dc64c9a26cafbbd390614654f4a67e6e
5
5
  SHA512:
6
- metadata.gz: 2f548aca262b8d887feb3c9563c878ca43f28ee45332385a9c8ae5131d45da5157f1b5358329dc4556897961882dbca4f01e13762256b5cd12dfa563a893cd6c
7
- data.tar.gz: 149e23c7d3efc40532483fa7c4f45f948c3340e59642ffdabfec1ec3b37c0dd39e56d2369a1eb6d939878a1d2c4c9389acc7b825734e5e71490b4ef91babd3b4
6
+ metadata.gz: a79e5e4e8d11fb0e4d5cc1b7e047bb244ee4b09a55b56bb66507b87d9caa72f07e8d877ca8f94126416d529960e8cbee1e52c4167123d44b23efa430e084a852
7
+ data.tar.gz: b618217458ca12f7f89718014ab0f04025d9eecc9559c566185b0c37ed9077f1f3e0564e82d60e36167e742865f09747f864a638f64aad72c5d98a5b8494d6d8
@@ -18,4 +18,8 @@ module AttendeaseJekyllConfigMixin
18
18
  def live_mode?
19
19
  !!attendease['live_mode']
20
20
  end
21
+
22
+ def private_site?
23
+ !!attendease['private_site']
24
+ end
21
25
  end
@@ -38,7 +38,7 @@ module Jekyll
38
38
  fallback: lambda { |c| fallback.key?(c) ? fallback[c] : undefined })
39
39
  end
40
40
 
41
- PAGE_KEYS = %w[id name href weight root children parent hidden].freeze
41
+ PAGE_KEYS = %w[id name description href weight root children parent hidden].freeze
42
42
 
43
43
  # filter the raw pages for what's safe to make public
44
44
  def self.public_pages(pages)
@@ -12,6 +12,7 @@ module Jekyll
12
12
  self.read_yaml(File.join(base, '_layouts'), "#{page['layout']}.html")
13
13
 
14
14
  self.data['title'] = page['name']
15
+ self.data['description'] = page['description']
15
16
  self.data['layout'] = page['layout']
16
17
 
17
18
  self.data['site_page'] = page
@@ -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
-
@@ -1,6 +1,5 @@
1
1
  module Jekyll
2
2
  module AttendeasePlugin
3
- VERSION = '0.9.6'
3
+ VERSION = '0.9.9'
4
4
  end
5
5
  end
6
-
@@ -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.6
4
+ version: 0.9.9
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-04-01 00:00:00.000000000 Z
15
+ date: 2022-03-11 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
- rubyforge_project:
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