jekyll-attendease 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jekyll-attendease.rb +38 -0
  2. metadata +1 -1
@@ -58,5 +58,43 @@ module Jekyll
58
58
  end
59
59
  end
60
60
 
61
+
62
+ class EventThemes < Generator
63
+ def generate(site)
64
+ puts "Generating theme layout..."
65
+
66
+ attendease_precompiled_theme_layouts_path = "#{site.config['source']}/attendease_layouts"
67
+
68
+ FileUtils.mkdir_p(attendease_precompiled_theme_layouts_path)
69
+
70
+ layouts_to_precompile = ['layout', 'register', 'schedule', 'presenters']
71
+
72
+ # Precompiled layout for website sections.
73
+ layouts_to_precompile.each do |layout|
74
+ if File.exists?("#{site.config['source']}/_layouts/layout.html")
75
+
76
+ # create a layout file if is already doesn't exist.
77
+ # the layout file will be used by attendease to wrap /register, /schedule, /presnters in the
78
+ # look the compiled file defines.
79
+ # ensure {{ content }} is in the file so we can render content in there!
80
+ if !File.exists?("#{site.config['source']}/attendease_layouts/#{layout}.html")
81
+ theme_layout_content = <<-eos
82
+ ---
83
+ layout: layout
84
+ ---
85
+
86
+ {% raw %}
87
+ {{ content }}
88
+ {% endraw %}
89
+ eos
90
+
91
+ File.open("#{site.config['source']}/attendease_layouts/#{layout}.html", 'w+') { |file| file.write(theme_layout_content) }
92
+ end
93
+ end
94
+ end
95
+
96
+ end
97
+ end
98
+
61
99
  end
62
100
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jekyll-attendease
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Wood