coursegen 0.9.17 → 0.9.21
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 +4 -4
- data/Gemfile.lock +62 -47
- data/coursegen.gemspec +1 -0
- data/lib/coursegen/course/data/citem.rb +18 -1
- data/lib/coursegen/course/data/data_adaptor.rb +2 -2
- data/lib/coursegen/course/data/section.rb +12 -2
- data/lib/coursegen/course/helpers/bootstrap_markup.rb +2 -2
- data/lib/coursegen/course/helpers/content_helpers.rb +25 -3
- data/lib/coursegen/course/helpers/list_of.rb +3 -4
- data/lib/coursegen/course/helpers/list_of_helpers.rb +1 -0
- data/lib/coursegen/course/helpers/table_helpers.rb +3 -6
- data/lib/coursegen/course/helpers/visual_helpers.rb +15 -3
- data/lib/coursegen/course/lib/nanoc_filters.rb +14 -4
- data/lib/coursegen/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b56c0b807e916341052ecd96905c1bc871865fee63f7c71815fcf9d7814d27b
|
|
4
|
+
data.tar.gz: 39f5a5c2f4dbd30a4e0c68c55d02e39dfa53fadaa22a468211fdb44a95216086
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 251bdf602d00a8cc6ad043768148ccf30fdc7a47b27c22050d2f014ce3c9b61736d4fb2ba1c990e485f33b9eb6ee28041ffe59edb971e87996fdb202e575999b
|
|
7
|
+
data.tar.gz: 17bf9af7c79f545d474b4f7b11e7145ed8ada2547443e387d25e04df860d94e501b275429f4301ef02458c53c0566eb1e1e076f81de2f3b8a407fc530a8dcffd
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
coursegen (0.9.
|
|
4
|
+
coursegen (0.9.21)
|
|
5
5
|
activesupport
|
|
6
6
|
adsf
|
|
7
7
|
byebug
|
|
@@ -11,6 +11,7 @@ PATH
|
|
|
11
11
|
icalendar
|
|
12
12
|
kramdown
|
|
13
13
|
nanoc
|
|
14
|
+
nanoc-live
|
|
14
15
|
nokogiri
|
|
15
16
|
rubytree
|
|
16
17
|
thor
|
|
@@ -19,84 +20,92 @@ PATH
|
|
|
19
20
|
GEM
|
|
20
21
|
remote: https://rubygems.org/
|
|
21
22
|
specs:
|
|
22
|
-
activesupport (
|
|
23
|
+
activesupport (7.0.1)
|
|
23
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
24
25
|
i18n (>= 1.6, < 2)
|
|
25
26
|
minitest (>= 5.1)
|
|
26
27
|
tzinfo (~> 2.0)
|
|
27
|
-
|
|
28
|
-
addressable (2.7.0)
|
|
28
|
+
addressable (2.8.0)
|
|
29
29
|
public_suffix (>= 2.0.2, < 5.0)
|
|
30
|
-
adsf (1.4.
|
|
30
|
+
adsf (1.4.6)
|
|
31
31
|
rack (>= 1.0.0, < 3.0.0)
|
|
32
|
+
adsf-live (1.4.6)
|
|
33
|
+
adsf (~> 1.3)
|
|
34
|
+
em-websocket (~> 0.5)
|
|
35
|
+
eventmachine (~> 1.2)
|
|
36
|
+
listen (~> 3.0)
|
|
37
|
+
rack-livereload (~> 0.3)
|
|
32
38
|
byebug (11.1.3)
|
|
33
39
|
coderay (1.1.3)
|
|
34
40
|
colored (1.2)
|
|
35
|
-
concurrent-ruby (1.1.
|
|
41
|
+
concurrent-ruby (1.1.9)
|
|
36
42
|
cri (2.15.11)
|
|
37
|
-
ddmemoize (1.0.0)
|
|
38
|
-
ddmetrics (~> 1.0)
|
|
39
|
-
ref (~> 2.0)
|
|
40
43
|
ddmetrics (1.0.1)
|
|
41
44
|
ddplugin (1.0.3)
|
|
42
|
-
diff-lcs (1.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
diff-lcs (1.5.0)
|
|
46
|
+
em-websocket (0.5.3)
|
|
47
|
+
eventmachine (>= 0.12.9)
|
|
48
|
+
http_parser.rb (~> 0)
|
|
49
|
+
eventmachine (1.2.7)
|
|
50
|
+
ffi (1.15.5)
|
|
51
|
+
formatador (0.3.0)
|
|
52
|
+
guard (2.18.0)
|
|
46
53
|
formatador (>= 0.2.4)
|
|
47
54
|
listen (>= 2.7, < 4.0)
|
|
48
55
|
lumberjack (>= 1.0.12, < 2.0)
|
|
49
56
|
nenv (~> 0.1)
|
|
50
57
|
notiffany (~> 0.0)
|
|
51
|
-
pry (>= 0.
|
|
58
|
+
pry (>= 0.13.0)
|
|
52
59
|
shellany (~> 0.0)
|
|
53
60
|
thor (>= 0.18.1)
|
|
54
61
|
guard-compat (1.2.1)
|
|
55
|
-
guard-shell (0.7.
|
|
62
|
+
guard-shell (0.7.2)
|
|
56
63
|
guard (>= 2.0.0)
|
|
57
64
|
guard-compat (~> 1.0)
|
|
58
65
|
hamster (3.0.0)
|
|
59
66
|
concurrent-ruby (~> 1.0)
|
|
60
|
-
|
|
67
|
+
http_parser.rb (0.8.0)
|
|
68
|
+
i18n (1.8.11)
|
|
61
69
|
concurrent-ruby (~> 1.0)
|
|
62
70
|
icalendar (2.7.1)
|
|
63
71
|
ice_cube (~> 0.16)
|
|
64
|
-
ice_cube (0.16.
|
|
65
|
-
json (2.
|
|
72
|
+
ice_cube (0.16.4)
|
|
73
|
+
json (2.6.1)
|
|
66
74
|
json_schema (0.21.0)
|
|
67
75
|
kramdown (2.3.1)
|
|
68
76
|
rexml
|
|
69
|
-
listen (3.
|
|
77
|
+
listen (3.7.1)
|
|
70
78
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
71
79
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
72
80
|
lumberjack (1.2.8)
|
|
81
|
+
memo_wise (1.5.0)
|
|
73
82
|
method_source (1.0.0)
|
|
74
|
-
minitest (5.
|
|
75
|
-
nanoc (4.12.
|
|
83
|
+
minitest (5.15.0)
|
|
84
|
+
nanoc (4.12.4)
|
|
76
85
|
addressable (~> 2.5)
|
|
77
86
|
colored (~> 1.2)
|
|
78
87
|
nanoc-checking (~> 1.0)
|
|
79
|
-
nanoc-cli (= 4.12.
|
|
80
|
-
nanoc-core (= 4.12.
|
|
88
|
+
nanoc-cli (= 4.12.4)
|
|
89
|
+
nanoc-core (= 4.12.4)
|
|
81
90
|
nanoc-deploying (~> 1.0)
|
|
82
91
|
parallel (~> 1.12)
|
|
83
92
|
tty-command (~> 0.8)
|
|
84
93
|
tty-which (~> 0.4)
|
|
85
|
-
nanoc-checking (1.0.
|
|
86
|
-
nanoc-cli (~> 4.
|
|
87
|
-
nanoc-core (~> 4.
|
|
88
|
-
nanoc-cli (4.12.
|
|
94
|
+
nanoc-checking (1.0.2)
|
|
95
|
+
nanoc-cli (~> 4.12, >= 4.12.4)
|
|
96
|
+
nanoc-core (~> 4.12, >= 4.12.4)
|
|
97
|
+
nanoc-cli (4.12.4)
|
|
89
98
|
cri (~> 2.15)
|
|
90
99
|
diff-lcs (~> 1.3)
|
|
91
|
-
nanoc-core (= 4.12.
|
|
100
|
+
nanoc-core (= 4.12.4)
|
|
92
101
|
zeitwerk (~> 2.1)
|
|
93
|
-
nanoc-core (4.12.
|
|
102
|
+
nanoc-core (4.12.4)
|
|
94
103
|
concurrent-ruby (~> 1.1)
|
|
95
|
-
ddmemoize (~> 1.0)
|
|
96
104
|
ddmetrics (~> 1.0)
|
|
97
105
|
ddplugin (~> 1.0)
|
|
98
106
|
hamster (~> 3.0)
|
|
99
107
|
json_schema (~> 0.19)
|
|
108
|
+
memo_wise (~> 1.5)
|
|
100
109
|
slow_enumerator_tools (~> 1.0)
|
|
101
110
|
tty-platform (~> 0.2)
|
|
102
111
|
zeitwerk (~> 2.1)
|
|
@@ -104,26 +113,32 @@ GEM
|
|
|
104
113
|
nanoc-checking (~> 1.0)
|
|
105
114
|
nanoc-cli (~> 4.11, >= 4.11.15)
|
|
106
115
|
nanoc-core (~> 4.11, >= 4.11.15)
|
|
116
|
+
nanoc-live (1.0.0)
|
|
117
|
+
adsf-live (~> 1.4)
|
|
118
|
+
listen (~> 3.0)
|
|
119
|
+
nanoc-cli (~> 4.11, >= 4.11.14)
|
|
120
|
+
nanoc-core (~> 4.11, >= 4.11.14)
|
|
107
121
|
nenv (0.3.0)
|
|
108
|
-
nokogiri (1.
|
|
122
|
+
nokogiri (1.13.1-x86_64-darwin)
|
|
109
123
|
racc (~> 1.4)
|
|
110
124
|
notiffany (0.1.3)
|
|
111
125
|
nenv (~> 0.1)
|
|
112
126
|
shellany (~> 0.0)
|
|
113
|
-
parallel (1.
|
|
127
|
+
parallel (1.21.0)
|
|
114
128
|
pastel (0.8.0)
|
|
115
129
|
tty-color (~> 0.5)
|
|
116
|
-
pry (0.14.
|
|
130
|
+
pry (0.14.1)
|
|
117
131
|
coderay (~> 1.1)
|
|
118
132
|
method_source (~> 1.0)
|
|
119
133
|
public_suffix (4.0.6)
|
|
120
|
-
racc (1.
|
|
134
|
+
racc (1.6.0)
|
|
121
135
|
rack (2.2.3)
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
rack-livereload (0.3.17)
|
|
137
|
+
rack
|
|
138
|
+
rake (13.0.6)
|
|
139
|
+
rb-fsevent (0.11.0)
|
|
124
140
|
rb-inotify (0.10.1)
|
|
125
141
|
ffi (~> 1.0)
|
|
126
|
-
ref (2.0.0)
|
|
127
142
|
rexml (3.2.5)
|
|
128
143
|
rspec (3.10.0)
|
|
129
144
|
rspec-core (~> 3.10.0)
|
|
@@ -131,31 +146,31 @@ GEM
|
|
|
131
146
|
rspec-mocks (~> 3.10.0)
|
|
132
147
|
rspec-core (3.10.1)
|
|
133
148
|
rspec-support (~> 3.10.0)
|
|
134
|
-
rspec-expectations (3.10.
|
|
149
|
+
rspec-expectations (3.10.2)
|
|
135
150
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
136
151
|
rspec-support (~> 3.10.0)
|
|
137
152
|
rspec-mocks (3.10.2)
|
|
138
153
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
139
154
|
rspec-support (~> 3.10.0)
|
|
140
|
-
rspec-support (3.10.
|
|
141
|
-
rubytree (1.0.
|
|
142
|
-
json (~> 2.1)
|
|
143
|
-
structured_warnings (~> 0.
|
|
155
|
+
rspec-support (3.10.3)
|
|
156
|
+
rubytree (1.0.2)
|
|
157
|
+
json (~> 2.6.1)
|
|
158
|
+
structured_warnings (~> 0.4.0)
|
|
144
159
|
shellany (0.0.1)
|
|
145
160
|
slow_enumerator_tools (1.1.0)
|
|
146
161
|
structured_warnings (0.4.0)
|
|
147
|
-
thor (1.1
|
|
162
|
+
thor (1.2.1)
|
|
148
163
|
tty-color (0.6.0)
|
|
149
164
|
tty-command (0.10.1)
|
|
150
165
|
pastel (~> 0.8)
|
|
151
166
|
tty-platform (0.3.0)
|
|
152
|
-
tty-which (0.
|
|
167
|
+
tty-which (0.5.0)
|
|
153
168
|
tzinfo (2.0.4)
|
|
154
169
|
concurrent-ruby (~> 1.0)
|
|
155
|
-
zeitwerk (2.
|
|
170
|
+
zeitwerk (2.5.3)
|
|
156
171
|
|
|
157
172
|
PLATFORMS
|
|
158
|
-
|
|
173
|
+
x86_64-darwin-21
|
|
159
174
|
|
|
160
175
|
DEPENDENCIES
|
|
161
176
|
bundler
|
|
@@ -164,4 +179,4 @@ DEPENDENCIES
|
|
|
164
179
|
rspec
|
|
165
180
|
|
|
166
181
|
BUNDLED WITH
|
|
167
|
-
2.
|
|
182
|
+
2.3.3
|
data/coursegen.gemspec
CHANGED
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.add_dependency 'icalendar'
|
|
31
31
|
spec.add_dependency 'kramdown'
|
|
32
32
|
spec.add_dependency 'nanoc'
|
|
33
|
+
spec.add_dependency 'nanoc-live'
|
|
33
34
|
spec.add_dependency 'nokogiri'
|
|
34
35
|
spec.add_dependency 'rubytree'
|
|
35
36
|
spec.add_dependency 'thor'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'byebug'
|
|
2
2
|
require 'active_support/inflector'
|
|
3
|
+
require 'date'
|
|
3
4
|
|
|
4
5
|
#
|
|
5
6
|
# Coursegen Item decorates Nanoc Item
|
|
@@ -93,10 +94,26 @@ class CItem
|
|
|
93
94
|
@slides = @nitem[:slides]
|
|
94
95
|
@lectref = @nitem[:lectref]
|
|
95
96
|
@reading = @nitem[:reading]
|
|
96
|
-
@due = @nitem[:due]
|
|
97
|
+
@due = parse_date(@nitem[:due])
|
|
97
98
|
|
|
98
99
|
end
|
|
99
100
|
|
|
101
|
+
def parse_date(datestring)
|
|
102
|
+
if datestring.nil? || datestring == "TBD"
|
|
103
|
+
val = Date.parse("jan-1-1985")
|
|
104
|
+
else
|
|
105
|
+
# Date.parse(datestring)
|
|
106
|
+
val = Date.strptime(datestring, "%m/%d/%y")
|
|
107
|
+
end
|
|
108
|
+
# if val.nil?
|
|
109
|
+
# puts "Nil date: #{datestring} #{@title}"
|
|
110
|
+
# end
|
|
111
|
+
val
|
|
112
|
+
rescue
|
|
113
|
+
puts("bad parse date: #{datestring}")
|
|
114
|
+
nil
|
|
115
|
+
end
|
|
116
|
+
|
|
100
117
|
def parse_identifier(ident)
|
|
101
118
|
parts = ident.to_s.split("/")
|
|
102
119
|
@section ||= parts[2]
|
|
@@ -36,6 +36,8 @@ class DataAdaptor
|
|
|
36
36
|
citem.homework
|
|
37
37
|
when :assigned
|
|
38
38
|
citem.assigned
|
|
39
|
+
when :cat
|
|
40
|
+
citem.cat
|
|
39
41
|
when :start_date_time
|
|
40
42
|
citem.schedule_start_date_time
|
|
41
43
|
when :end_date_time
|
|
@@ -44,8 +46,6 @@ class DataAdaptor
|
|
|
44
46
|
desc = citem.desc || ''
|
|
45
47
|
hw = citem.homework || ''
|
|
46
48
|
desc + '. HW: ' + hw
|
|
47
|
-
when :cat
|
|
48
|
-
citem.cat
|
|
49
49
|
when :lectref
|
|
50
50
|
citem.lectref
|
|
51
51
|
when :hwref
|
|
@@ -19,7 +19,7 @@ class Section
|
|
|
19
19
|
|
|
20
20
|
def find_by_short_name(sname)
|
|
21
21
|
matches = @citems.select { |c| sname == c.short_name }
|
|
22
|
-
raise RuntimeError,"'#{sname}': invalid reference in section \"#{@section}\"" if matches.length == 0
|
|
22
|
+
raise RuntimeError, "'#{sname}': invalid reference in section \"#{@section}\"" if matches.length == 0
|
|
23
23
|
raise RuntimeError, "'#{sname}': duplicate referenced in section \"#{@section}\"" if matches.length != 1
|
|
24
24
|
matches[0]
|
|
25
25
|
end
|
|
@@ -73,6 +73,16 @@ class Section
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def sort_pages
|
|
76
|
-
@citems.sort! { |a,b| a.order <=> b.order
|
|
76
|
+
@citems.sort! { |a,b| a.order <=> b.order} rescue fail "sort_pages in section.rb"
|
|
77
|
+
# @citems.sort! do |a, b|
|
|
78
|
+
# comp = a.order <=> b.order
|
|
79
|
+
# if !(a.due.nil? || b.due.nil?)
|
|
80
|
+
# if a.due.class != Date || b.due.class != Date
|
|
81
|
+
# puts "sort_pages_type #{a.title} #{b.title} #{a.class} #{b.class}"
|
|
82
|
+
# end
|
|
83
|
+
# comp = a.due <=> b.due
|
|
84
|
+
# end
|
|
85
|
+
# comp
|
|
86
|
+
# end
|
|
77
87
|
end
|
|
78
88
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ContentHelpers is used to annotate content.
|
|
2
2
|
module ContentHelpers
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
def include_topic(item_symbol)
|
|
5
5
|
incorporated_topic = lookup_nitem('topics', item_symbol.to_s)
|
|
6
6
|
items[incorporated_topic.identifier.to_s].compiled_content
|
|
@@ -67,7 +67,7 @@ module ContentHelpers
|
|
|
67
67
|
HTMLSTRING
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
def
|
|
70
|
+
def callout3(title, body, style="big")
|
|
71
71
|
style = style.to_s if style.class != String
|
|
72
72
|
if (style == "big")
|
|
73
73
|
%(<div class="jumbotron py-1 border border-primary border-rounded-lg">
|
|
@@ -84,6 +84,24 @@ module ContentHelpers
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
def callout(title, body, style="big")
|
|
88
|
+
style = style.to_s if style.class != String
|
|
89
|
+
if (style == "big")
|
|
90
|
+
%(<div class="callout callout-big">
|
|
91
|
+
<h1 class="display-5">#{title}</h1>
|
|
92
|
+
<p class="lead">#{body}</p></div>)
|
|
93
|
+
elsif (style == "small")
|
|
94
|
+
<<~HTMLSTRING
|
|
95
|
+
<div class="callout callout-small">
|
|
96
|
+
<span class="callout-badge">#{title}</span>#{body}
|
|
97
|
+
</div>
|
|
98
|
+
HTMLSTRING
|
|
99
|
+
else
|
|
100
|
+
"error in callout call: .#{style}. #{style.class}"
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
|
|
87
105
|
def iconbadge1(icon, tooltip)
|
|
88
106
|
%(<img src="/bootstrap/bootstrap-icons-1.0.0/#{icon}.svg" title="#{tooltip}" class="iconbadge">)
|
|
89
107
|
end
|
|
@@ -194,10 +212,14 @@ module ContentHelpers
|
|
|
194
212
|
"*Discussion:*{: style=\"color: blue\"} *#{string}*"
|
|
195
213
|
end
|
|
196
214
|
|
|
197
|
-
def
|
|
215
|
+
def discussion_box1(string)
|
|
198
216
|
%(<div class="alert alert-info"><strong>Discussion:</strong> #{string}</div>)
|
|
199
217
|
end
|
|
200
218
|
|
|
219
|
+
def discussion_box(string)
|
|
220
|
+
%(<div class="discussionbox"><strong>Discussion:</strong> #{string}</div>)
|
|
221
|
+
end
|
|
222
|
+
|
|
201
223
|
def homework_hdr(show_legend: :on)
|
|
202
224
|
body = '## Homework due for today'
|
|
203
225
|
legend = "\n**Legend**: #{partbadge}: Participation (pass/fail) | #{pdfbadge}: PDF | #{teambadge}: Team | #{zipbadge}: Attachment"
|
|
@@ -29,7 +29,7 @@ class ListOf
|
|
|
29
29
|
|
|
30
30
|
# Render renders the underlying lecture table.
|
|
31
31
|
def render
|
|
32
|
-
@mark.table_begin
|
|
32
|
+
@mark.table_begin("table-striped table-sm table-responsive table-hover")
|
|
33
33
|
generate_headers
|
|
34
34
|
generate_rows
|
|
35
35
|
@mark.table_end
|
|
@@ -53,7 +53,6 @@ class ListOf
|
|
|
53
53
|
def generate_rows
|
|
54
54
|
@data.rows do |row_id|
|
|
55
55
|
next unless include_row?(row_id)
|
|
56
|
-
|
|
57
56
|
if subsection_hdr?(row_id)
|
|
58
57
|
generate_summary_row(row_id)
|
|
59
58
|
else
|
|
@@ -108,11 +107,11 @@ class ListOf
|
|
|
108
107
|
end
|
|
109
108
|
|
|
110
109
|
def include_by_row_type?(row_id)
|
|
111
|
-
@rows.include?(row_id.type)
|
|
110
|
+
tf = @rows.include?(row_id.type)
|
|
112
111
|
end
|
|
113
112
|
|
|
114
113
|
def include_by_subsection_path?(row_id)
|
|
115
|
-
@subsections.empty? || @subsections.include?(row_id.subsection)
|
|
114
|
+
tf = @subsections.empty? || @subsections.include?(row_id.subsection)
|
|
116
115
|
end
|
|
117
116
|
|
|
118
117
|
def subsection_hdr?(row_id)
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# Class TableHelper provides methods for creating a table.
|
|
2
2
|
class TableHelper
|
|
3
|
-
def initialize(
|
|
4
|
-
@
|
|
3
|
+
def initialize(css_styles)
|
|
4
|
+
@css_styles = css_styles
|
|
5
5
|
@bm = BootstrapMarkup.new
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def headers(*labels)
|
|
9
|
-
|
|
10
|
-
css_style += ' table-condensed' if @prop.include? :normal
|
|
11
|
-
css_style += ' table-bordered' if @prop.include? :bordered
|
|
12
|
-
@bm.table_begin(css_style)
|
|
9
|
+
@bm.table_begin(@css_styles)
|
|
13
10
|
@bm.headers_begin
|
|
14
11
|
labels.each do |h|
|
|
15
12
|
@bm.header_begin
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
module VisualHelpers
|
|
2
|
-
|
|
3
|
-
def end_of_lecture(type=:thatsall)
|
|
2
|
+
def end_of_lecture(type=:random)
|
|
4
3
|
if (type == :thatsall)
|
|
5
|
-
"<slide_break></slide_break
|
|
4
|
+
part1 = "<slide_break></slide_break>\n\n"
|
|
5
|
+
part2 = "## See you next time!!\n\n"
|
|
6
|
+
part3 = "<img src=\"/content/topics/images/thatsallfolks.jpg\" class=\"img-thumbnail d-block mx-auto\" style=\"height:300px;\"/>"
|
|
7
|
+
part4 = ""
|
|
8
|
+
elsif type == :random
|
|
9
|
+
part1 = "<slide_break></slide_break>\n\n"
|
|
10
|
+
part2 = "<h2 class=\"shadow p-3 bg-white rounded\">Thank you. Questions?"
|
|
11
|
+
part3 = random_image :normal, "800", "100"
|
|
12
|
+
part4 = "<small> (random Image from picsum.photos)</small>\</h2>"
|
|
6
13
|
end
|
|
14
|
+
part1 + part2 + part3 + part4
|
|
7
15
|
end
|
|
8
16
|
end
|
|
17
|
+
|
|
18
|
+
def random_image(_style, width, height)
|
|
19
|
+
"<img class=\"img-fluid\ w-100\" src=\"https://picsum.photos/#{width}/#{height}.jpg\" /> "
|
|
20
|
+
end
|
|
@@ -5,16 +5,22 @@ Nanoc::Filter.define(:handle_shortcodes) do |content, _params = {}|
|
|
|
5
5
|
content
|
|
6
6
|
.gsub(Regexp.new(prefix.source + /callout :(\w+), "(.+)", "(.+)"/.source)) { callout($2, $3, $1) }
|
|
7
7
|
.gsub(Regexp.new(prefix.source + /deliverable (.+)$/.source)) { deliverable($1) }
|
|
8
|
-
.gsub(Regexp.new(prefix.source + /discussion_box (.+)
|
|
8
|
+
.gsub(Regexp.new(prefix.source + /discussion_box "(.+)"/.source)) { discussion_box($1) }
|
|
9
9
|
.gsub(Regexp.new(prefix.source + /h1 (.+)$/.source), "# \\1 ")
|
|
10
10
|
.gsub(Regexp.new(prefix.source + /h2 (.+)$/.source), "## \\1 ")
|
|
11
11
|
.gsub(Regexp.new(prefix.source + /h3 (.+)$/.source), "### \\1 ")
|
|
12
12
|
.gsub(Regexp.new(prefix.source + /h4 (.+)$/.source), "#### \\1 ")
|
|
13
|
-
.gsub(Regexp.new(prefix.source + /
|
|
13
|
+
.gsub(Regexp.new(prefix.source + /h5 (.+)$/.source)) { "<h5>#{$1}</h5>" }
|
|
14
|
+
.gsub(Regexp.new(prefix.source + /image :(\w+)$/.source)) { "<img src=\"/content/topics/images/#{$1}.jpg\" class=\"img-thumbnail d-block mx-auto\" style=\"height:300px;\"/>" }
|
|
15
|
+
.gsub(Regexp.new(prefix.source + /image :(\w+), :(\w+)$/.source)) { "<img src=\"/content/topics/images/#{$2}.jpg\" class=\"img-thumbnail d-block mx-auto\" style=\"height:#{$1}px;\"/>" }
|
|
14
16
|
.gsub(Regexp.new(prefix.source + /lecture_end/.source), end_of_lecture)
|
|
17
|
+
.gsub(Regexp.new(prefix.source + /li (.+)$/.source)) { "<li>#{$1}</li>" }
|
|
15
18
|
.gsub(Regexp.new(prefix.source + /partbadge/.source), partbadge)
|
|
16
19
|
.gsub(Regexp.new(prefix.source + /pdfbadge/.source), pdfbadge)
|
|
17
|
-
.gsub(Regexp.new(prefix.source + /
|
|
20
|
+
.gsub(Regexp.new(prefix.source + /image_random "(\w+)", "(\w+)"/.source)) { "<img src=\"https://picsum.photos/#{$1}/#{$2}.jpg\" /> "}
|
|
21
|
+
.gsub(Regexp.new(prefix.source + /image_rnd :(\w+), "(.+)", "(.+)"/.source)) { random_image($1, $2, $3) }
|
|
22
|
+
.gsub(Regexp.new(prefix.source + /section_link :(\w+), :(\w+)/.source)) { link_to_section($1, $2) }
|
|
23
|
+
.gsub(Regexp.new(prefix.source + /section_include :(\w+), :(\w+)/.source)) { include_from_section($1, $2) }
|
|
18
24
|
.gsub(Regexp.new(prefix.source + /slide_bigtitle (.+)$/.source), "<slide_break></slide_break>\n\n## \\1")
|
|
19
25
|
.gsub(Regexp.new(prefix.source + /slide_break/.source), "<slide_break></slide_break>")
|
|
20
26
|
.gsub(Regexp.new(prefix.source + /slide_subtitle (.+)$/.source), "<slide_break></slide_break>\n\n#### \\1")
|
|
@@ -25,6 +31,10 @@ Nanoc::Filter.define(:handle_shortcodes) do |content, _params = {}|
|
|
|
25
31
|
.gsub(Regexp.new(prefix.source + /teambadge/.source), teambadge)
|
|
26
32
|
.gsub(Regexp.new(prefix.source + /topic_include :(\w+)$/.source)) { include_topic($1) }
|
|
27
33
|
.gsub(Regexp.new(prefix.source + /topic_link :(\w+)/.source)) { link_to_topic($1) }
|
|
34
|
+
.gsub(Regexp.new(prefix.source + /ul_begin :(\w+)/.source)) { "<ul class=\"#{$1}\">" }
|
|
35
|
+
.gsub(Regexp.new(prefix.source + /ul_begin$/.source)) { "<ul>" }
|
|
36
|
+
.gsub(Regexp.new(prefix.source + /ul_end$/.source)) { "</ul>" }
|
|
28
37
|
.gsub(Regexp.new(prefix.source + /youtube \"(.+)\"$/.source)) { %Q!<iframe width="560" height="315" src="#{$1}"></iframe>! }
|
|
29
38
|
.gsub(Regexp.new(prefix.source + /zipbadge/.source), zipbadge)
|
|
30
|
-
|
|
39
|
+
|
|
40
|
+
end
|
data/lib/coursegen/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: coursegen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pito Salas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -178,6 +178,20 @@ dependencies:
|
|
|
178
178
|
- - ">="
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: '0'
|
|
181
|
+
- !ruby/object:Gem::Dependency
|
|
182
|
+
name: nanoc-live
|
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
|
184
|
+
requirements:
|
|
185
|
+
- - ">="
|
|
186
|
+
- !ruby/object:Gem::Version
|
|
187
|
+
version: '0'
|
|
188
|
+
type: :runtime
|
|
189
|
+
prerelease: false
|
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
191
|
+
requirements:
|
|
192
|
+
- - ">="
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: '0'
|
|
181
195
|
- !ruby/object:Gem::Dependency
|
|
182
196
|
name: nokogiri
|
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -352,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
352
366
|
- !ruby/object:Gem::Version
|
|
353
367
|
version: '0'
|
|
354
368
|
requirements: []
|
|
355
|
-
rubygems_version: 3.
|
|
369
|
+
rubygems_version: 3.3.3
|
|
356
370
|
signing_key:
|
|
357
371
|
specification_version: 4
|
|
358
372
|
summary: Use Nanoc to build courses and deploy them to S3
|