coursegen 0.8.3 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/pr.yml +19 -0
  3. data/.gitignore +3 -0
  4. data/Gemfile.lock +60 -35
  5. data/README.md +285 -69
  6. data/Rakefile +10 -1
  7. data/coursegen.gemspec +26 -26
  8. data/lib/coursegen.rb +5 -2
  9. data/lib/coursegen/cli.rb +49 -14
  10. data/lib/coursegen/course/data/citem.rb +10 -1
  11. data/lib/coursegen/course/data/data_adaptor.rb +16 -6
  12. data/lib/coursegen/course/data/section.rb +1 -1
  13. data/lib/coursegen/course/helpers/bootstrap_markup.rb +15 -15
  14. data/lib/coursegen/course/helpers/content_helpers.rb +86 -71
  15. data/lib/coursegen/course/helpers/formatting_helpers.rb +6 -10
  16. data/lib/coursegen/course/helpers/ical_feed_helpers.rb +2 -1
  17. data/lib/coursegen/course/helpers/lecture_helpers.rb +3 -2
  18. data/lib/coursegen/course/helpers/list_of.rb +40 -20
  19. data/lib/coursegen/course/helpers/list_of_helpers.rb +20 -14
  20. data/lib/coursegen/course/helpers/logging_helpers.rb +13 -12
  21. data/lib/coursegen/course/helpers/navigation_helpers.rb +62 -23
  22. data/lib/coursegen/course/helpers/sidebar_helpers.rb +19 -18
  23. data/lib/coursegen/course/helpers/table_helpers.rb +5 -4
  24. data/lib/coursegen/course/schedule/scheduler.rb +52 -19
  25. data/lib/coursegen/templates.rb +30 -23
  26. data/lib/coursegen/version.rb +3 -1
  27. data/spec/lectures_spec.rb +60 -50
  28. data/spec/play_spec.rb +24 -12
  29. data/spec/scheduler_spec.rb +87 -27
  30. data/tech_debt.md +5 -0
  31. data/templates/Rules +14 -19
  32. data/templates/cg_config.rb +105 -21
  33. data/templates/content/bootstrap/css/custom.css +87 -151
  34. data/templates/content/bootstrap/css/full-width-pics.css +8 -64
  35. data/templates/content/bootstrap/css/postit.css +7 -0
  36. data/templates/content/bootstrap/css/toasty.css +3 -0
  37. data/templates/content/content/index.md.erb +1 -1
  38. data/templates/content/content/intro/course_toc.md.erb +0 -1
  39. data/templates/content/content/intro/welcome.md.erb +1 -3
  40. data/templates/content/content/lectures/part1/02_here_we_go.md.erb +22 -1
  41. data/templates/content/content/lectures/part2/01_start_part2.md.erb +2 -1
  42. data/templates/content/content/lectures/part2/02_continue_part2.md.erb +3 -2
  43. data/templates/layouts/banner.html.erb +4 -4
  44. data/templates/layouts/body_footer.html +3 -4
  45. data/templates/layouts/body_header.html.erb +25 -7
  46. data/templates/layouts/bottom_includes.html.erb +21 -10
  47. data/templates/layouts/course.html.erb +7 -21
  48. data/templates/layouts/helpful_box.html +1 -1
  49. data/templates/layouts/nav-menus.html.erb +16 -36
  50. data/templates/layouts/sidebar.html.erb +9 -8
  51. data/templates/layouts/slides.html.erb +69 -0
  52. data/templates/layouts/top_includes.html.erb +24 -23
  53. metadata +32 -24
  54. data/.DS_Store +0 -0
  55. data/.vscode/settings.json +0 -2
  56. data/templates/.DS_Store +0 -0
  57. data/templates/Guardfile +0 -9
  58. data/templates/content/bootstrap/css/tipuesearch.css +0 -163
  59. data/templates/content/bootstrap/js/tipuesearch.js +0 -379
  60. data/templates/content/bootstrap/js/tipuesearch.min.js +0 -12
  61. data/templates/content/bootstrap/js/tipuesearch_content.js +0 -13
  62. data/templates/content/bootstrap/js/tipuesearch_set.js +0 -23
  63. data/templates/layouts/main_navbar.html.erb +0 -21
@@ -6,5 +6,10 @@
6
6
  * Make the way mocks are built in specs more consitent
7
7
  * A way to have a nested section which is not an 'event' based section
8
8
  * Clean up the placement of the .js files for the search stuff. It's a bit messy
9
+ * Add more tests
9
10
 
10
11
  ### Features
12
+
13
+ * generate pdf
14
+ * more elaborate sample course in cg itself
15
+ * document the different macros
@@ -20,10 +20,6 @@ compile '/content/scripts/**/*' do
20
20
  nil
21
21
  end
22
22
 
23
- compile "/content/tipuesearch/tipuesearch_content.js.erb" do
24
- filter :erb
25
- end
26
-
27
23
  compile '/**/*.ical.erb' do
28
24
  filter :erb
29
25
  end
@@ -38,6 +34,16 @@ compile '/**/*.{md,ical}.erb' do
38
34
  end
39
35
  end
40
36
 
37
+ compile '/**/*.md.erb', rep: :slides do
38
+ if item[:status] != "hidden"
39
+ filter :erb
40
+ layout '/slides.*'
41
+ write item.identifier.without_ext + '/slides.html'
42
+ else
43
+ nil
44
+ end
45
+ end
46
+
41
47
  compile '/**/*' do
42
48
  if item.binary? || item[:status] == "hidden"
43
49
  nil
@@ -48,31 +54,20 @@ route '/bootstrap/**/*' do
48
54
  @item.identifier.to_s
49
55
  end
50
56
 
51
- route '/tipuesearch/**/*' do
52
- @item.identifier.to_s
53
- end
54
-
55
- route "/content/tipuesearch/tipuesearch_content.*" do
56
- '/tipuesearch/tipuesearch_content.js'
57
- end
58
-
59
- # Output the search page
60
- route '/tipuesearch/search.md.erb' do
61
- '/tipuesearch/search/index.html'
62
- end
63
-
64
57
  # Select which .md.erb becomes the home page of the site
65
58
  route HOME_PAGE do
66
59
  '/index.html'
67
60
  end
68
61
 
62
+ route HOME_PAGE, rep: :slides do
63
+ '/slides.html'
64
+ end
65
+
69
66
  route '/**/*' do
70
67
  if item[:extension].nil?
71
68
  raise RuntimeError, "Missing required extension: \".#{item.identifier}\""
72
69
  elsif item.binary?
73
70
  item.identifier.to_s
74
- elsif item.identifier == "/searchtipuesearch_content/"
75
- item.identifier.chop + '.' + item[:extension] rescue fail "in route * in Rules"
76
71
  elsif item[:status] == "hidden"
77
72
  nil
78
73
  elsif item[:type] == "subsection"
@@ -1,30 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Coursegen configuration file.
4
+ #
5
+ # Note that in order to read the configuration file, this file must be at the
6
+ # root of the course directory.
1
7
  require 'coursegen'
2
8
 
3
- # Copyright string
4
- COPYRIGHT_STRING = "Copyright (2013-2019) R. Pito Salas, pitosalas@gmail.com"
9
+ # AUTHOR
10
+ AUTHOR_NAME = 'yourname'
11
+ AUTHOR_EMAIL = 'yourname'
12
+ COPYRIGHT_STRING = "Copyright (2013-#{Time.now.year}) #{AUTHOR_NAME}, #{AUTHOR_EMAIL}"
13
+
14
+ # Bucket Deployment of the course
15
+ AWS_BUCKET = "yourbucketname"
16
+
17
+ # COURSE
18
+ COURSE_SHORT_NAME = 'cool'
19
+ COURSE_LONG_NAME = 'Cool Course'
20
+ COURSE_ABBREV = 'CC'
5
21
 
6
- # Course short name
7
- COURSE_SHORT_NAME = "Sample Course"
8
- COURSE_LONG_NAME = "Sample Coursegen Course"
9
- COURSE_ABBREV = "SC"
22
+ # Lectures_schedule defines the schedule of lectures.
23
+ #
24
+ # This is primarily used to 1) figure out the time and date of each class,
25
+ # and 2) figure out the ordering of classes on the sidebar.
10
26
 
11
27
  LECTURES_SCHEDULE_CONFIG = ScheduleDef.new(
12
- first_day: "jan-17-2017",
13
- weekdays: [:tuesday, :wednesday, :thursday],
14
- start_times: ["15:30", "14:00", "15:30"],
15
- end_times: ["16:50", "16:00", "16:50"],
16
- number: 39,
28
+ first_day: "jul-20-2020",
29
+ weekdays: [:monday,],
30
+ start_times: ["15:30", "15:30"],
31
+ end_times: ["16:50", "16:50"],
32
+ number: 28,
33
+ skips: [],
17
34
  start_time: "15:30",
18
- end_time: "16:50",
19
- skips: ["feb-9-2017", "feb-21-2017", "feb-22-2017", "feb-23-2017", "apr-11-2017", "apr-12-2017", "apr-13-2017", "apr-18-2017", "apr-19-2017"])
35
+ end_time: "16:50"
36
+ )
20
37
 
21
- # Sections in the right hand margin of the page
38
+ # Section_config defines the structure of the course.
39
+ #
40
+ # Each section is defined by
41
+ # title name of the section
42
+ # selector directory of the section (under /content)
43
+ # type type of the section (:section or :lecture)
44
+ # schedule schedule of the lecture (only needed for :lecture)
45
+ #
46
+ # Additionally, you can choose to hide the section on the sidebar by setting
47
+ # hidden: true.
22
48
  SECTION_CONFIG = [
23
- SectionDef.new("Intro", "intro", type: :section),
24
- SectionDef.new("Lectures", "lectures", type: :lecture, schedule: LECTURES_SCHEDULE_CONFIG),
25
- SectionDef.new("Extras", "extras", hidden: true, type: :section)
26
- ]
27
- # Options are:
28
- # bullet_style: css style for each bullet
29
- STYLING_CONFIG = {bullet_style: "\"font-size: 60%; width: 10px; color: grey\""}
49
+ SectionDef.new("Intro", "intro", type: :section, collapsed: false, bullet: :star),
50
+ SectionDef.new("Lectures", "lectures",
51
+ type: :lecture, schedule: LECTURES_SCHEDULE_CONFIG, bullet: :dash),
52
+ SectionDef.new("Homework", "homework", hidden: true, type: :section),
53
+ ].freeze
54
+
55
+ # SITE
56
+ #
57
+ # The URL of the deployed site.
58
+ # Please include any http or https prefix.
59
+ SITE_URL = "http://coolcourse.s3-website-us-east-1.amazonaws.com"
60
+
61
+ # Home_page sets the home page of the site.
62
+ # This is usually /content/index.md.erb.
63
+ #
64
+ # Note: the .erb suffix is required when setting the HOME_PAGE path.
65
+ HOME_PAGE = "/content/intro/welcome.md.erb"
66
+
67
+ # Menulinks defines the links on the navigation bar.
68
+ # They are formatted as "Name" - "URL" pair.
69
+ #
70
+ # Examples:
71
+ # %w[HOME /content/index.md]
72
+ # %w[TOC /content/course_toc.md]
73
+ MENULINKS = [%w[lectures /content/intro/welcome.md/]].freeze
74
+
75
+ # Helpful_box provides a feedback box on the sidebar.
76
+ #
77
+ # DO NOT USE. This is currently not functional.
30
78
  HELPFUL_BOX = false
79
+
80
+ # STYLING
81
+ #
82
+ # Options:
83
+ # bullet_style: css style for each bullet
84
+ STYLING_CONFIG = {
85
+ bullet_style: '"font-size: 60%; width: 10px; color: grey"'
86
+ }.freeze
87
+
88
+ # SEARCH
89
+ #
90
+ # Coursegen uses DocSearch by Algolia (https://docsearch.algolia.com/) to
91
+ # provide site-wide full-text search functionality.
92
+ #
93
+ # In order for search to function, you need to replace with your own
94
+ # search API key, and name of your index from Algolia.
95
+ # For details, please refer to https://github.com/pitosalas/coursegen/blob/master/README.md.
96
+ SEARCH_CONFIG = {
97
+ api_key: '855a55e631c6523e8201162e6d9c1e9c',
98
+ index_name: 'coolcourse',
99
+ # APP_ID is only used if you are running DocSearch on your own.
100
+ app_id: '',
101
+ debug: false
102
+ }.freeze
103
+
104
+ # SLIDES
105
+ SLIDES_CONFIG = {
106
+ # Ignore_selectors ignore certain html elements from rendering in the slides.
107
+ ignore_selectors: ['li ul'],
108
+
109
+ # Reveal.js specific options
110
+ # See: https://revealjs.com/config/
111
+ revealjs_opts: {
112
+ transition: 'slide'
113
+ }
114
+ }.freeze
@@ -1,33 +1,27 @@
1
1
  @import url("prettyquote.css");
2
2
  @import url("full-width-pics.css");
3
3
  @import url(//fonts.googleapis.com/css?family=Telex);
4
+ @import url("postit.css");
5
+ @import url("toasty.css");
6
+
7
+ html {
8
+ font-size: 0.9rem;
9
+ }
10
+ body {
11
+ padding-bottom: 40px;
12
+ }
4
13
 
5
14
  .themefg {
6
- color: rgb(64,56,207);
15
+ color: rgb(64, 56, 207);
7
16
  }
8
17
 
9
18
  .themebg {
10
- background-color: rgb(64,56,207);
19
+ background-color: rgb(64, 56, 207);
11
20
  }
12
21
  .nav-menus {
13
22
  height: 0px;
14
23
  }
15
-
16
- .navbar-inverse .navbar-nav > li > a {
17
- padding-top: 4px;
18
- padding-bottom: 0px;
19
- color: white;
20
- }
21
-
22
- .navbar-inverse .navbar-nav > li > a:hover {
23
- font-weight: bold;
24
- }
25
-
26
- a {
27
- color: rgb(64,56,207);
28
- }
29
-
30
- .navbar a.navbar-title {
24
+ .masthead a {
31
25
  font-family: telex;
32
26
  float: left;
33
27
  margin-top: 20px;
@@ -54,19 +48,19 @@ a {
54
48
  }
55
49
 
56
50
  .navbar {
57
- min-height: 35px;
58
- margin-bottom: 1px;
51
+ min-height: 35px;
52
+ margin-bottom: 1px;
59
53
  }
60
54
 
61
55
  .navbar a:hover {
62
- color: white;
56
+ color: white;
63
57
  text-decoration: none;
64
58
  }
65
59
 
66
- .navbar .input-group-sm input{
67
- height: 22px;
68
- width: 150px;
69
- margin-top: 4px;
60
+ .navbar .input-group-sm input {
61
+ height: 22px;
62
+ width: 150px;
63
+ margin-top: 4px;
70
64
  }
71
65
 
72
66
  .header-main {
@@ -77,176 +71,118 @@ a {
77
71
  padding-left: 45px;
78
72
  }
79
73
 
80
- h1, h2, h3, h4, h5{
81
- font-family: telex;
82
- color: rgb(64,56,207);
74
+ h1,
75
+ h2,
76
+ h3,
77
+ h4,
78
+ h5,
79
+ h6 {
80
+ font-family: telex;
81
+ color: rgb(64, 56, 207);
83
82
  }
84
83
 
85
- h3 {
84
+ h1 {
86
85
  padding-top: 20px;
87
- /* padding-bottom: 10px; */
86
+ font-size: 1.5rem;
87
+ }
88
+
89
+ h2 {
90
+ margin-top: 20px;
91
+ border-top: rgb(64, 56, 207) solid 2px;
92
+ padding-top: 5px;
93
+ font-size: 1.30rem;
88
94
  }
89
95
 
90
- /* h3.body-header {
91
- margin-left: -15px;
92
- margin-top: -10px;
93
- margin-right: -15px;
94
- margin-bottom: -22px;
95
- } */
96
+ h3 {
97
+ font-size: 1.1rem;
98
+ }
99
+
100
+ h3.subheader {
101
+ /* border-bottom: rgb(64, 56, 207) solid 2px; */
102
+ padding-bottom: 5px;
103
+ margin-bottom: 10px;
104
+
105
+ }
96
106
 
97
107
  h4 {
98
- margin-top: 20px;
99
- border-top: rgb(64,56,207) solid 3px;
100
- padding-top: 5px;
108
+ font-size: 1.0rem;
109
+ margin-left: 18px;
101
110
  }
102
111
 
112
+ /* Table use only */
103
113
  h5 {
104
- margin-top: 15px;
105
- font-weight: bold;
114
+ margin-top: 15px;
115
+ font-size: 0.8rem;
106
116
  font-variant: small-caps;
107
117
  }
108
118
 
109
- body {
110
- padding-top: 40px;
111
- padding-bottom: 40px;
119
+ footer {
120
+ padding-top: 20px;
112
121
  }
113
122
 
114
- footer {
115
- padding-top: 20px;
123
+ .sidebar {
124
+ background-color: rgb(247, 241, 213);
125
+ margin-top: 20px;
116
126
  }
117
127
 
118
- .right-nav ul {
119
- list-style: none;
120
- padding-left: 12px;
121
- margin-top: 3px
128
+ .sidebar ul {
129
+ list-style: none;
130
+ padding-left: 12px;
131
+ margin-top: 3px;
122
132
  }
123
133
 
124
- .right-nav label.level2 {
125
- margin-bottom: 0px;
134
+ .sidebar label.level2 {
135
+ margin-bottom: 0px;
126
136
  }
127
137
 
128
- .right-nav a {
129
- font-size: 85%;
138
+ .sidebar a {
139
+ font-size: 85%;
130
140
  }
131
141
 
132
- .right-nav label.level1 {
133
- text-transform: uppercase;
134
- color: grey;
135
- margin-top: 10px;
136
- margin-bottom: 3px;
142
+ .sidebar label.level1 {
143
+ text-transform: uppercase;
144
+ color: grey;
145
+ margin-top: 10px;
146
+ margin-bottom: 3px;
137
147
  }
138
148
 
139
- .right-nav label.level2 {
140
- font-weight: normal;
149
+ .sidebar label.level2 {
150
+ font-weight: normal;
141
151
  }
142
152
 
143
153
  .CodeRay .line-numbers {
144
- margin-right: 15px;
154
+ margin-right: 15px;
145
155
  }
146
156
 
147
157
  .tree .bold a {
148
- font-weight: bold;
158
+ font-weight: bold;
149
159
  }
150
160
 
151
161
  .tree .red a {
152
- color: red;
162
+ color: red;
153
163
  }
154
164
  .tree .italic a {
155
- font-style: italic;
165
+ font-style: italic;
156
166
  }
157
167
 
158
168
  .glyphicon-small {
159
- font-size: 10px;
169
+ font-size: 10px;
160
170
  }
161
171
 
162
- /* Search Page */
163
-
164
172
  .h01 {
165
- color: red;
166
- font-weight: bold;
167
- }
168
-
169
- #tipue_search_results_count {
170
- font-size: 14px;
171
- color: red;
172
- font-family: telex;
173
- }
174
-
175
- .tipue_search_content_title {
176
- color: purple;
177
- font-size: 16px;
178
- margin-top: 15px;
179
- margin-left: 10px;
180
- text-rendering: optimizelegibility;
181
- font-family: telex;
182
- }
183
-
184
- .tipue_search_content_text {
185
- font-size: 14px;
186
- margin-left: 30px;
187
- }
188
-
189
- div.tipue_search_content_loc a {
190
- font-size: 14px;
191
- margin-left: 20px;
192
- display: none;
193
- }
194
-
195
- #tipue_search_foot
196
- {
197
- margin: 51px 0 21px 0;
198
- }
199
- #tipue_search_foot_boxes
200
- {
201
- padding: 0;
202
- margin: 0;
203
- font: 12px/1 'Open Sans', sans-serif;
204
- }
205
- #tipue_search_foot_boxes li
206
- {
207
- list-style: none;
208
- margin: 0;
209
- padding: 0;
210
- display: inline;
211
- }
212
- #tipue_search_foot_boxes li a
213
- {
214
- padding: 9px 15px 10px 15px;
215
- background-color: #f1f1f1;
216
- border: 1px solid #dcdcdc;
217
- border-radius: 1px;
218
- color: #333;
219
- margin-right: 7px;
220
- text-decoration: none;
221
- text-align: center;
222
- }
223
- #tipue_search_foot_boxes li.current
224
- {
225
- padding: 9px 15px 10px 15px;
226
- background: #fff;
227
- border: 1px solid #dcdcdc;
228
- border-radius: 1px;
229
- color: #333;
230
- margin-right: 7px;
231
- text-align: center;
232
- }
233
- #tipue_search_foot_boxes li a:hover
234
- {
235
- border: 1px solid #ccc;
236
- background-color: #f3f3f3;
237
- }
238
-
239
- .helpful
240
- {
173
+ color: red;
174
+ font-weight: bold;
175
+ }
176
+
177
+ .helpful {
241
178
  visibility: hidden;
242
179
  }
243
180
 
244
181
  @media (max-width: 980px) {
245
-
246
- /* Enable use of floated navbar text */
247
- .navbar-text.pull-right {
248
- float: none;
249
- padding-left: 5px;
250
- padding-right: 5px;
251
- }
182
+ /* Enable use of floated navbar text */
183
+ .navbar-text.pull-right {
184
+ float: none;
185
+ padding-left: 5px;
186
+ padding-right: 5px;
187
+ }
252
188
  }