24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/jekyll/attendease_plugin/event_template_generator.rb', line 24
def generate(site)
Jekyll.logger.info "[Attendease] Generating theme templates..."
%w{ schedule presenters venues sponsors pages }.each do |p|
path = File.join(site.source, '_attendease', 'templates', p)
FileUtils.mkdir_p(path)
raise "Could not create #{path}." unless File.exists?(path)
end
template_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'templates', 'attendease'))
base_layout = site.config['attendease']['base_layout'] || 'layout'
front_matter = <<EOF
---
layout: #{base_layout}
---
EOF
%w{
index
schedule/index
schedule/day
schedule/sessions
schedule/session
presenters/index
presenters/presenter
venues/index
venues/venue
sponsors/index
pages/default
}.each do |page|
destination_file = File.join(site.source, '_attendease', 'templates', "#{page}.html")
unless File.exists?(destination_file)
template_data = front_matter + File.read(File.join(template_path, "#{page}.html"))
File.open(destination_file, 'w+') { |f| f.write(template_data) }
end
end
page = 'schedule/widget'
destination_file = File.join(site.source, '_attendease', 'templates', "#{page}.html")
unless File.exists?(destination_file)
template_data = File.read(File.join(template_path, "#{page}.html"))
File.open(destination_file, 'w+') { |f| f.write(template_data) }
end
end
|