Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
galaxyproject
GitHub Repository: galaxyproject/training-material
Path: blob/main/_plugins/generator-recordings.rb
1677 views
1
# frozen_string_literal: true
2
3
require './_plugins/gtn'
4
5
module Jekyll
6
module Generators
7
##
8
# This class generates the GTN's recording pages
9
class RecordingPageGenerator < Generator
10
safe true
11
12
##
13
# This generates the recording pages, where needed.
14
# Params
15
# +site+:: The site object
16
def generate(site)
17
Jekyll.logger.info "[GTN/Videos] Generating recording pages"
18
materials = Gtn::TopicFilter
19
.list_all_materials(site)
20
21
with_video = materials
22
.select{|m| m.has_key? 'recordings' or m.has_key? 'slide_recordings'}
23
24
Jekyll.logger.info "[GTN/Videos] #{with_video.length} materials with recordings found."
25
materials.each do |material|
26
page2 = PageWithoutAFile.new(site, '', material['dir'], 'recordings/index.html')
27
page2.content = nil
28
page2.data['layout'] = 'recordings'
29
page2.data['topic_name'] = material['topic_name']
30
page2.data['tutorial_name'] = material['tutorial_name']
31
page2.data['material'] = material
32
page2.data['title'] = 'Recordings for ' + material['title']
33
site.pages << page2
34
end
35
end
36
end
37
end
38
end
39
40