Skip to content

Commit eb76373

Browse files
authored
Merge pull request #90 from LibraryCarpentry/upgrade-template
2 parents 7be56cb + 17cb6d8 commit eb76373

38 files changed

+591
-264
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [carpentries, swcarpentry, datacarpentry, librarycarpentry]
2+
custom: ["https://carpentries.wedid.it"]

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
Please delete this line and the text below before submitting your contribution.
1+
<details>
2+
<summary><strong>Instructions</strong></summary>
23

3-
---
4+
Thanks for contributing! :heart:
45

5-
Thanks for contributing! If this contribution is for instructor training, please send an email to [email protected] with a link to this contribution so we can record your progress. You’ve completed your contribution step for instructor checkout just by submitting this contribution.
6+
If this contribution is for instructor training, please email the link to this contribution to
7+
[email protected] so we can record your progress. You've completed your contribution
8+
step for instructor checkout by submitting this contribution!
69

710
If this issue is about a specific episode within a lesson, please provide its link or filename.
811

9-
Please keep in mind that lesson maintainers are volunteers and it may be some time before they can respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact The Carpentries Team at [email protected].
12+
Keep in mind that **lesson maintainers are volunteers** and it may take them some time to
13+
respond to your contribution. Although not all contributions can be incorporated into the lesson
14+
materials, we appreciate your time and effort to improve the curriculum. If you have any questions
15+
about the lesson maintenance process or would like to volunteer your time as a contribution
16+
reviewer, please contact The Carpentries Team at [email protected].
1017

11-
---
18+
You may delete these instructions from your comment.
19+
20+
\- The Carpentries
21+
</details>

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
Please delete this line and the text below before submitting your contribution.
1+
<details>
2+
<summary><strong>Instructions</strong></summary>
23

3-
---
4+
Thanks for contributing! :heart:
45

5-
Thanks for contributing! If this contribution is for instructor training, please send an email to [email protected] with a link to this contribution so we can record your progress. You’ve completed your contribution step for instructor checkout just by submitting this contribution.
6+
If this contribution is for instructor training, please email the link to this contribution to
7+
[email protected] so we can record your progress. You've completed your contribution
8+
step for instructor checkout by submitting this contribution!
69

7-
Please keep in mind that lesson maintainers are volunteers and it may be some time before they can respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact The Carpentries Team at [email protected].
10+
Keep in mind that **lesson maintainers are volunteers** and it may take them some time to
11+
respond to your contribution. Although not all contributions can be incorporated into the lesson
12+
materials, we appreciate your time and effort to improve the curriculum. If you have any questions
13+
about the lesson maintenance process or would like to volunteer your time as a contribution
14+
reviewer, please contact The Carpentries Team at [email protected].
815

9-
---
16+
You may delete these instructions from your comment.
17+
18+
\- The Carpentries
19+
</details>

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
.DS_Store
44
.ipynb_checkpoints
55
.sass-cache
6+
.jekyll-cache/
67
__pycache__
78
_site
89
.Rproj.user
910
.Rhistory
1011
.RData
11-
12-
/Gemfile.lock
12+
.bundle/
13+
.vendor/
14+
.docker-vendor/
15+
Gemfile.lock
16+
.*history

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
4+
5+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6+
7+
# Synchronize with https://pages.github.com/versions
8+
ruby '>=2.5.8'
9+
210
gem 'github-pages', group: :jekyll_plugins

Makefile

Lines changed: 74 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,72 @@
1+
# Use /bin/bash instead of /bin/sh
2+
export SHELL = /bin/bash
3+
14
## ========================================
25
## Commands for both workshop and lesson websites.
36

47
# Settings
58
MAKEFILES=Makefile $(wildcard *.mk)
6-
JEKYLL=bundle exec jekyll
7-
JEKYLL_VERSION=3.7.3
9+
JEKYLL=bundle config --local set path .vendor/bundle && bundle install && bundle update && bundle exec jekyll
810
PARSER=bin/markdown_ast.rb
911
DST=_site
1012

13+
# Check Python 3 is installed and determine if it's called via python3 or python
14+
# (https://stackoverflow.com/a/4933395)
15+
PYTHON3_EXE := $(shell which python3 2>/dev/null)
16+
ifneq (, $(PYTHON3_EXE))
17+
ifeq (,$(findstring Microsoft/WindowsApps/python3,$(subst \,/,$(PYTHON3_EXE))))
18+
PYTHON := python3
19+
endif
20+
endif
21+
22+
ifeq (,$(PYTHON))
23+
PYTHON_EXE := $(shell which python 2>/dev/null)
24+
ifneq (, $(PYTHON_EXE))
25+
PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1)))
26+
PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL})
27+
ifneq (3, ${PYTHON_VERSION_MAJOR})
28+
$(error "Your system does not appear to have Python 3 installed.")
29+
endif
30+
PYTHON := python
31+
else
32+
$(error "Your system does not appear to have any Python installed.")
33+
endif
34+
endif
35+
36+
1137
# Controls
1238
.PHONY : commands clean files
13-
.NOTPARALLEL:
14-
all : commands
1539

16-
## commands : show all commands.
17-
commands :
18-
@grep -h -E '^##' ${MAKEFILES} | sed -e 's/## //g'
40+
# Default target
41+
.DEFAULT_GOAL := commands
1942

20-
## docker-serve : use docker to build the site
21-
docker-serve :
22-
docker run --rm -it -v ${PWD}:/srv/jekyll -p 127.0.0.1:4000:4000 jekyll/jekyll:${JEKYLL_VERSION} make serve
43+
## I. Commands for both workshop and lesson websites
44+
## =================================================
2345

24-
## serve : run a local server.
46+
## * serve : render website and run a local server
2547
serve : lesson-md
2648
${JEKYLL} serve
2749

28-
## site : build files but do not run a server.
50+
## * site : build website but do not run a server
2951
site : lesson-md
3052
${JEKYLL} build
3153

32-
# repo-check : check repository settings.
54+
## * docker-serve : use Docker to serve the site
55+
docker-serve :
56+
docker pull carpentries/lesson-docker:latest
57+
docker run --rm -it \
58+
-v $${PWD}:/home/rstudio \
59+
-p 4000:4000 \
60+
-p 8787:8787 \
61+
-e USERID=$$(id -u) \
62+
-e GROUPID=$$(id -g) \
63+
carpentries/lesson-docker:latest
64+
65+
## * repo-check : check repository settings
3366
repo-check :
34-
@bin/repo_check.py -s .
67+
@${PYTHON} bin/repo_check.py -s .
3568

36-
## clean : clean up junk files.
69+
## * clean : clean up junk files
3770
clean :
3871
@rm -rf ${DST}
3972
@rm -rf .sass-cache
@@ -42,22 +75,26 @@ clean :
4275
@find . -name '*~' -exec rm {} \;
4376
@find . -name '*.pyc' -exec rm {} \;
4477

45-
## clean-rmd : clean intermediate R files (that need to be committed to the repo).
78+
## * clean-rmd : clean intermediate R files (that need to be committed to the repo)
4679
clean-rmd :
4780
@rm -rf ${RMD_DST}
4881
@rm -rf fig/rmd-*
4982

50-
## ----------------------------------------
51-
## Commands specific to workshop websites.
83+
84+
##
85+
## II. Commands specific to workshop websites
86+
## =================================================
5287

5388
.PHONY : workshop-check
5489

55-
## workshop-check : check workshop homepage.
90+
## * workshop-check : check workshop homepage
5691
workshop-check :
57-
@bin/workshop_check.py .
92+
@${PYTHON} bin/workshop_check.py .
5893

59-
## ----------------------------------------
60-
## Commands specific to lesson websites.
94+
95+
##
96+
## III. Commands specific to lesson websites
97+
## =================================================
6198

6299
.PHONY : lesson-check lesson-md lesson-files lesson-fixme
63100

@@ -85,37 +122,39 @@ HTML_DST = \
85122
$(patsubst _extras/%.md,${DST}/%/index.html,$(sort $(wildcard _extras/*.md))) \
86123
${DST}/license/index.html
87124

88-
## lesson-md : convert Rmarkdown files to markdown
125+
## * lesson-md : convert Rmarkdown files to markdown
89126
lesson-md : ${RMD_DST}
90127

91128
_episodes/%.md: _episodes_rmd/%.Rmd
92129
@bin/knit_lessons.sh $< $@
93130

94-
## lesson-check : validate lesson Markdown.
131+
# * lesson-check : validate lesson Markdown
95132
lesson-check : lesson-fixme
96-
@bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
133+
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
97134

98-
## lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace.
135+
## * lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace
99136
lesson-check-all :
100-
@bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
137+
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
101138

102-
## unittest : run unit tests on checking tools.
139+
## * unittest : run unit tests on checking tools
103140
unittest :
104-
@bin/test_lesson_check.py
141+
@${PYTHON} bin/test_lesson_check.py
105142

106-
## lesson-files : show expected names of generated files for debugging.
143+
## * lesson-files : show expected names of generated files for debugging
107144
lesson-files :
108145
@echo 'RMD_SRC:' ${RMD_SRC}
109146
@echo 'RMD_DST:' ${RMD_DST}
110147
@echo 'MARKDOWN_SRC:' ${MARKDOWN_SRC}
111148
@echo 'HTML_DST:' ${HTML_DST}
112149

113-
## lesson-fixme : show FIXME markers embedded in source files.
150+
## * lesson-fixme : show FIXME markers embedded in source files
114151
lesson-fixme :
115152
@fgrep -i -n FIXME ${MARKDOWN_SRC} || true
116153

117-
#-------------------------------------------------------------------------------
118-
# Include extra commands if available.
119-
#-------------------------------------------------------------------------------
154+
##
155+
## IV. Auxililary (plumbing) commands
156+
## =================================================
120157

121-
-include commands.mk
158+
## * commands : show all commands.
159+
commands :
160+
@sed -n -e '/^##/s|^##[[:space:]]*||p' $(MAKEFILE_LIST)

_includes/aio-script.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{% comment %}
2+
As a maintainer, you don't need to edit this file.
3+
If you notice that something doesn't work, please
4+
open an issue: https://github.com/carpentries/styles/issues/new
5+
{% endcomment %}
6+
7+
{% include manual_episode_order.html %}
8+
9+
{% for lesson_episode in lesson_episodes %}
10+
11+
{% if site.episode_order %}
12+
{% assign e = site.episodes | where: "slug", lesson_episode | first %}
13+
{% else %}
14+
{% assign e = lesson_episode %}
15+
{% endif %}
16+
17+
<h1 id="{{ e.title | slugify }}" class="maintitle">{{ e.title }}</h1>
18+
19+
{% include episode_overview.html teaching_time=e.teaching exercise_time=e.exercises episode_questions=e.questions episode_objectives=e.objectives %}
20+
21+
{{ e.content }}
22+
23+
{% include episode_keypoints.html episode_keypoints=e.keypoints %}
24+
<hr />
25+
{% endfor %}

_includes/all_keypoints.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
{% endcomment %}
44

55
{% include base_path.html %}
6+
{% include manual_episode_order.html %}
67

78
<h2>Key Points</h2>
89
<table class="table table-striped">
9-
{% for episode in site.episodes %}
10+
{% for lesson_episode in lesson_episodes %}
11+
{% if site.episode_order %}
12+
{% assign episode = site.episodes | where: "slug", lesson_episode | first %}
13+
{% else %}
14+
{% assign episode = lesson_episode %}
15+
{% endif %}
1016
{% unless episode.break %}
1117
<tr>
1218
<td class="col-md-3">

_includes/episode_keypoints.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
{% comment %}
22
Display key points for an episode.
33
{% endcomment %}
4+
5+
{% if page.keypoints == nil %}
6+
{% assign episode_keypoints = include.episode_keypoints %}
7+
{% else %}
8+
{% assign episode_keypoints = page.keypoints %}
9+
{% endif %}
10+
411
<blockquote class="keypoints">
512
<h2>Key Points</h2>
613
<ul>
7-
{% for keypoint in page.keypoints %}
14+
{% for keypoint in episode_keypoints %}
815
<li>{{ keypoint|markdownify }}</li>
916
{% endfor %}
1017
</ul>

_includes/episode_navbar.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99
Navigation bar for an episode.
1010
{% endcomment %}
1111

12+
{% include manual_episode_order.html %}
13+
{% comment %}
14+
'previous_episode' and 'next_episodes' are defined in 'manual_episode_order.html'.
15+
These replace 'page.previous' and 'page.next' objects, correspondingly.
16+
{% endcomment %}
17+
1218
<div class="row">
1319
<div class="col-xs-1">
1420
<h3 class="text-left">
15-
{% if page.previous.url %}
16-
<a href="{{ relative_root_path }}{{ page.previous.url }}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span><span class="sr-only">previous episode</span></a>
21+
{% if previous_episode %}
22+
<a href="{{ relative_root_path }}{{ previous_episode.url }}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span><span class="sr-only">previous episode</span></a>
1723
{% else %}
1824
<a href="{{ relative_root_path }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
1925
{% endif %}
@@ -26,8 +32,8 @@ <h3 class="maintitle"><a href="{{ relative_root_path }}/">{{ site.title }}</a></
2632
</div>
2733
<div class="col-xs-1">
2834
<h3 class="text-right">
29-
{% if page.next.url %}
30-
<a href="{{ relative_root_path }}{{ page.next.url }}"><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span><span class="sr-only">next episode</span></a>
35+
{% if next_episode %}
36+
<a href="{{ relative_root_path }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span><span class="sr-only">next episode</span></a>
3137
{% else %}
3238
<a href="{{ relative_root_path }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
3339
{% endif %}

0 commit comments

Comments
 (0)