coursegen 0.9.19 → 0.9.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e04b3546c2431660b1808e4a46648b73e332578f3ebeb46085d5f1ee675f3e5
4
- data.tar.gz: 166cec22386a715de6da584a500b191affb35e707b8518b0346a2e4db45902fe
3
+ metadata.gz: b9e50dd8f2b15ca41a4c6be41dfe795e9a3c7871b1e896ddef82f762718d59d8
4
+ data.tar.gz: f5a2be3d2bc475daf08563ed50f15b77c55a9f26f4f257dc50087b0e1a1e4739
5
5
  SHA512:
6
- metadata.gz: 51f148ce7a2c272afceb6bd370085bc18590c3e4ccd0a2671c8e6a5cca8c81f6be7f65a939858983afcf1d6f172e1d52bbaa83def34592ad4ddab5c8a0d9df6f
7
- data.tar.gz: 4887a9b340771d7796db1db3f56bfb83fe634eb2969eea2967234ba368c9b1eea46febb7f3cd2d65fd4ad3472801a24b7a06aedccb3e1428bc480db12936f296
6
+ metadata.gz: 981fb239270a51fac320818ddf0abe44c3ca7eb01af82c513870538d4b47039d59701df3e39c85d90ebf4ca3e023f7616fb28a1da73c314c857c6daf09a62e59
7
+ data.tar.gz: 3bf6c039b808f349ea6f6613b896ddcc2b5d569582c4f90b7cdee3df61e9a374b4846c4afc591d61743e71682ed60bf5415f528d7aeef85ac85b0ab21248488c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coursegen (0.9.19)
4
+ coursegen (0.9.20)
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,20 +20,26 @@ PATH
19
20
  GEM
20
21
  remote: https://rubygems.org/
21
22
  specs:
22
- activesupport (6.1.3.1)
23
+ activesupport (6.1.4.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
  zeitwerk (~> 2.3)
28
- addressable (2.7.0)
29
+ addressable (2.8.0)
29
30
  public_suffix (>= 2.0.2, < 5.0)
30
- adsf (1.4.5)
31
+ adsf (1.4.6)
31
32
  rack (>= 1.0.0, < 3.0.0)
33
+ adsf-live (1.4.6)
34
+ adsf (~> 1.3)
35
+ em-websocket (~> 0.5)
36
+ eventmachine (~> 1.2)
37
+ listen (~> 3.0)
38
+ rack-livereload (~> 0.3)
32
39
  byebug (11.1.3)
33
40
  coderay (1.1.3)
34
41
  colored (1.2)
35
- concurrent-ruby (1.1.8)
42
+ concurrent-ruby (1.1.9)
36
43
  cri (2.15.11)
37
44
  ddmemoize (1.0.0)
38
45
  ddmetrics (~> 1.0)
@@ -40,24 +47,29 @@ GEM
40
47
  ddmetrics (1.0.1)
41
48
  ddplugin (1.0.3)
42
49
  diff-lcs (1.4.4)
43
- ffi (1.15.0)
44
- formatador (0.2.5)
45
- guard (2.16.2)
50
+ em-websocket (0.5.2)
51
+ eventmachine (>= 0.12.9)
52
+ http_parser.rb (~> 0.6.0)
53
+ eventmachine (1.2.7)
54
+ ffi (1.15.4)
55
+ formatador (0.3.0)
56
+ guard (2.18.0)
46
57
  formatador (>= 0.2.4)
47
58
  listen (>= 2.7, < 4.0)
48
59
  lumberjack (>= 1.0.12, < 2.0)
49
60
  nenv (~> 0.1)
50
61
  notiffany (~> 0.0)
51
- pry (>= 0.9.12)
62
+ pry (>= 0.13.0)
52
63
  shellany (~> 0.0)
53
64
  thor (>= 0.18.1)
54
65
  guard-compat (1.2.1)
55
- guard-shell (0.7.1)
66
+ guard-shell (0.7.2)
56
67
  guard (>= 2.0.0)
57
68
  guard-compat (~> 1.0)
58
69
  hamster (3.0.0)
59
70
  concurrent-ruby (~> 1.0)
60
- i18n (1.8.10)
71
+ http_parser.rb (0.6.0)
72
+ i18n (1.8.11)
61
73
  concurrent-ruby (~> 1.0)
62
74
  icalendar (2.7.1)
63
75
  ice_cube (~> 0.16)
@@ -66,18 +78,18 @@ GEM
66
78
  json_schema (0.21.0)
67
79
  kramdown (2.3.1)
68
80
  rexml
69
- listen (3.5.1)
81
+ listen (3.7.0)
70
82
  rb-fsevent (~> 0.10, >= 0.10.3)
71
83
  rb-inotify (~> 0.9, >= 0.9.10)
72
84
  lumberjack (1.2.8)
73
85
  method_source (1.0.0)
74
86
  minitest (5.14.4)
75
- nanoc (4.12.1)
87
+ nanoc (4.12.2)
76
88
  addressable (~> 2.5)
77
89
  colored (~> 1.2)
78
90
  nanoc-checking (~> 1.0)
79
- nanoc-cli (= 4.12.1)
80
- nanoc-core (= 4.12.1)
91
+ nanoc-cli (= 4.12.2)
92
+ nanoc-core (= 4.12.2)
81
93
  nanoc-deploying (~> 1.0)
82
94
  parallel (~> 1.12)
83
95
  tty-command (~> 0.8)
@@ -85,12 +97,12 @@ GEM
85
97
  nanoc-checking (1.0.1)
86
98
  nanoc-cli (~> 4.11, >= 4.11.15)
87
99
  nanoc-core (~> 4.11, >= 4.11.15)
88
- nanoc-cli (4.12.1)
100
+ nanoc-cli (4.12.2)
89
101
  cri (~> 2.15)
90
102
  diff-lcs (~> 1.3)
91
- nanoc-core (= 4.12.1)
103
+ nanoc-core (= 4.12.2)
92
104
  zeitwerk (~> 2.1)
93
- nanoc-core (4.12.1)
105
+ nanoc-core (4.12.2)
94
106
  concurrent-ruby (~> 1.1)
95
107
  ddmemoize (~> 1.0)
96
108
  ddmetrics (~> 1.0)
@@ -104,8 +116,13 @@ GEM
104
116
  nanoc-checking (~> 1.0)
105
117
  nanoc-cli (~> 4.11, >= 4.11.15)
106
118
  nanoc-core (~> 4.11, >= 4.11.15)
119
+ nanoc-live (1.0.0)
120
+ adsf-live (~> 1.4)
121
+ listen (~> 3.0)
122
+ nanoc-cli (~> 4.11, >= 4.11.14)
123
+ nanoc-core (~> 4.11, >= 4.11.14)
107
124
  nenv (0.3.0)
108
- nokogiri (1.11.3-x86_64-darwin)
125
+ nokogiri (1.12.5-x86_64-darwin)
109
126
  racc (~> 1.4)
110
127
  notiffany (0.1.3)
111
128
  nenv (~> 0.1)
@@ -117,10 +134,12 @@ GEM
117
134
  coderay (~> 1.1)
118
135
  method_source (~> 1.0)
119
136
  public_suffix (4.0.6)
120
- racc (1.5.2)
137
+ racc (1.6.0)
121
138
  rack (2.2.3)
122
- rake (13.0.3)
123
- rb-fsevent (0.10.4)
139
+ rack-livereload (0.3.17)
140
+ rack
141
+ rake (13.0.6)
142
+ rb-fsevent (0.11.0)
124
143
  rb-inotify (0.10.1)
125
144
  ffi (~> 1.0)
126
145
  ref (2.0.0)
@@ -149,10 +168,10 @@ GEM
149
168
  tty-command (0.10.1)
150
169
  pastel (~> 0.8)
151
170
  tty-platform (0.3.0)
152
- tty-which (0.4.2)
171
+ tty-which (0.5.0)
153
172
  tzinfo (2.0.4)
154
173
  concurrent-ruby (~> 1.0)
155
- zeitwerk (2.4.2)
174
+ zeitwerk (2.5.2)
156
175
 
157
176
  PLATFORMS
158
177
  ruby
@@ -164,4 +183,4 @@ DEPENDENCIES
164
183
  rspec
165
184
 
166
185
  BUNDLED WITH
167
- 2.1.4
186
+ 2.2.23
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 } rescue fail "sort_pages in section.rb"
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
@@ -5,8 +5,8 @@ class BootstrapMarkup
5
5
  @str = ''
6
6
  end
7
7
 
8
- def table_begin(css_class = 'table-condensed')
9
- @str << "<table class=\"table x #{css_class}\">"
8
+ def table_begin(css_class = 'table-sm')
9
+ @str << "<table class=\"table #{css_class}\">"
10
10
  end
11
11
 
12
12
  def table_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
@@ -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,4 +1,5 @@
1
1
  # ListOfHelpers is used to create a lecture table.
2
+
2
3
  module ListOfHelpers
3
4
  # List_of creates and renders a lecture table based on the given info.
4
5
  #
@@ -1,15 +1,12 @@
1
1
  # Class TableHelper provides methods for creating a table.
2
2
  class TableHelper
3
- def initialize(*property)
4
- @prop = property
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
- css_style = ''
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
@@ -2,7 +2,10 @@ module VisualHelpers
2
2
 
3
3
  def end_of_lecture(type=:thatsall)
4
4
  if (type == :thatsall)
5
- "<slide_break></slide_break>" + include_image("/content/topics/images/thatsallfolks.jpg")
5
+ part1 = "<slide_break></slide_break>\n\n"
6
+ part2 = "## See you next time!!\n\n"
7
+ part3 = "<img src=\"/content/topics/images/thatsallfolks.jpg\" class=\"img-thumbnail d-block mx-auto\" style=\"height:300px;\"/>"
8
+ part1 + part2 + part3
6
9
  end
7
10
  end
8
11
  end
@@ -11,13 +11,14 @@ Nanoc::Filter.define(:handle_shortcodes) do |content, _params = {}|
11
11
  .gsub(Regexp.new(prefix.source + /h3 (.+)$/.source), "### \\1 ")
12
12
  .gsub(Regexp.new(prefix.source + /h4 (.+)$/.source), "#### \\1 ")
13
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\" style=\"height:300px;\"/>" }
15
- .gsub(Regexp.new(prefix.source + /image :(\w+), :(\w+)$/.source)) { "<img src=\"/content/topics/images/#{$2}.jpg\" class=\"img-thumbnail\" style=\"height:#{$1}px;\"/>" }
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;\"/>" }
16
16
  .gsub(Regexp.new(prefix.source + /lecture_end/.source), end_of_lecture)
17
17
  .gsub(Regexp.new(prefix.source + /li (.+)$/.source)) { "<li>#{$1}</li>" }
18
18
  .gsub(Regexp.new(prefix.source + /partbadge/.source), partbadge)
19
19
  .gsub(Regexp.new(prefix.source + /pdfbadge/.source), pdfbadge)
20
- .gsub(Regexp.new(prefix.source + /section_link :(\w+) :(\w+)/.source)) { link_to_section($1, $2) }
20
+ .gsub(Regexp.new(prefix.source + /section_link :(\w+), :(\w+)/.source)) { link_to_section($1, $2) }
21
+ .gsub(Regexp.new(prefix.source + /section_include :(\w+), :(\w+)/.source)) { include_from_section($1, $2) }
21
22
  .gsub(Regexp.new(prefix.source + /slide_bigtitle (.+)$/.source), "<slide_break></slide_break>\n\n## \\1")
22
23
  .gsub(Regexp.new(prefix.source + /slide_break/.source), "<slide_break></slide_break>")
23
24
  .gsub(Regexp.new(prefix.source + /slide_subtitle (.+)$/.source), "<slide_break></slide_break>\n\n#### \\1")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coursegen
4
- VERSION = '0.9.19'
4
+ VERSION = '0.9.20'
5
5
  end
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.19
4
+ version: 0.9.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pito Salas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-14 00:00:00.000000000 Z
11
+ date: 2021-12-30 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.1.4
369
+ rubygems_version: 3.2.22
356
370
  signing_key:
357
371
  specification_version: 4
358
372
  summary: Use Nanoc to build courses and deploy them to S3