jekyll-theme-open-course 1.2.2 → 1.3.0

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: 2bdae616ff9bf61b626bb82cb7da52c218c42c059234bed30fc97435268d8c1d
4
- data.tar.gz: 7e605a5610c25dd3956d142d3ef4e12a12441700465358cc56a0d5567fffde90
3
+ metadata.gz: '0695b828b4a9c6cc6f7daf682989a2f9b2d6733dcef9e8f36132772bb4930090'
4
+ data.tar.gz: 3baf24cd2b52376168d0cdca5d05c34ebce51106d2c92268d4c93be5fb0884a4
5
5
  SHA512:
6
- metadata.gz: 6976e631b9576e60075d5f7d5677b64f2db8ac62419d1e47f34cc488fbf093f67522e25ab2f6f0150f9733f3cd21f8c46afdb2794911413952b87cbbfc8fd23b
7
- data.tar.gz: 33cc7a394c66e65c479da0c413bd0665d034ef0ad7f9a315f71507eb5016f9a920caee02f38cae6e7af57c74f04a6a715ace97aa08303819eb430cdd607286bf
6
+ metadata.gz: 4de957ff6a9db42a0b97b8db8f679034d19f02efbb5219f8136bfca6716a87e19032ce92ed258cb4ab6794926ebb61103119d893d65821fe738f8230ac43a51b
7
+ data.tar.gz: a8db4a7d28aa773fcab866abda10c31647e004c771db152243fdd1a44c4c86a409fe4f74a2395a381b07981f7f12bdd23cccf4280c23fb239b7ddb1a42d775ea
@@ -73,7 +73,12 @@
73
73
  Course syllabus by <a href="{{ instructor.url }}">{{ instructor.name }}</a>.
74
74
  Licensed under
75
75
  <a href="{{ course.license.url }}" rel="license">{{ course.license.name }}</a>.
76
- <a id="github" href="{{ instructor.github }}{{ course.uid }}">Source hosted on GitHub</a>.
76
+ {% if course.archive %}
77
+ {% assign github_url = course.archive %}
78
+ {% else %}
79
+ {% capture github_url %}{{ instructor.github }}{{ course.uid }}{% endcapture %}
80
+ {% endif %}
81
+ <a id="github" href="{{ github_url }}">Source hosted on GitHub</a>.
77
82
  </p>
78
83
  </section>
79
84
  </footer>
@@ -235,7 +235,13 @@ if ('fetch' in window) {
235
235
  var url = document.querySelector('#github').getAttribute('href'); // grab the href value of the repo link
236
236
  if (typeof(url) !== 'undefined') {
237
237
  var fragment = url.substring(url.indexOf('.com/') + 5); // find the tail end (5 = .com/)
238
- return 'https://api.github.com/repos/' + fragment + '/commits?per_page=1'; // return the API url
238
+ var branch_regex = /tree/gi;
239
+ var branch_fragment = fragment.replace(branch_regex,'branches'); // replace 'tree' with 'branches'
240
+ // If not dealing with an archival branch (no replacement), append the `main` branch
241
+ if (fragment === branch_fragment) {
242
+ branch_fragment = fragment + '/branches/main';
243
+ }
244
+ return 'https://api.github.com/repos/' + branch_fragment; // return the branch API url
239
245
  }
240
246
  })();
241
247
 
@@ -251,14 +257,14 @@ if ('fetch' in window) {
251
257
  return response.json();
252
258
  })
253
259
  .then(function(data) {
260
+ var c = data.commit; // Work only with the commit property of the branch API response
254
261
  var commit = {};
255
- data = data[0]; // only need most recent commit
256
262
  // Lowercase commit message's first word to run in `...to XYZ` copy:
257
- commit.message = data.commit.message.charAt(0).toLowerCase() + data.commit.message.slice(1);
263
+ commit.message = c.commit.message.charAt(0).toLowerCase() + c.commit.message.slice(1);
258
264
  // Grab only the first line of a multiline message
259
265
  commit.message = commit.message.split("\n\n")[0];
260
- commit.url = data.html_url;
261
- commit.stamp = data.commit.author.date;
266
+ commit.url = c.html_url;
267
+ commit.stamp = c.commit.author.date;
262
268
  commit.date = new Date(commit.stamp);
263
269
  // Put the date in Day, Month 31 at <Local Time String> format
264
270
  commit.time_string = namedDays[commit.date.getDay()] + ', ' +
@@ -3,7 +3,7 @@ module JTOpenCourse
3
3
  require 'erb'
4
4
  require 'date'
5
5
 
6
- VERSION = "1.2.2"
6
+ VERSION = "1.3.0"
7
7
 
8
8
  SPELLED_NUMS = %w(
9
9
  Zero One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-open-course
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Stolley
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2020-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll