Skip to content

Commit d285ec4

Browse files
committed
Sync lesson style with carpentries/styles
Conflicts: _includes/javascript.html aio.md
2 parents e23ccd1 + 6f49049 commit d285ec4

30 files changed

Lines changed: 664 additions & 243 deletions

.github/workflows/template.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ jobs:
137137

138138
- name: Install needed packages
139139
if: steps.check-rmd.outputs.count != 0
140+
working-directory: lesson
140141
run: |
141-
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
142-
install.packages(packages, repo="https://cran.rstudio.com/")
142+
source('bin/dependencies.R')
143+
install_required_packages(.libPaths()[1])
143144
shell: Rscript {0}
144145

145146
- name: Query dependencies
@@ -149,13 +150,14 @@ jobs:
149150
source('bin/dependencies.R')
150151
deps <- identify_dependencies()
151152
create_description(deps)
153+
use_bioc_repos()
152154
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
153155
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
154156
shell: Rscript {0}
155157

156-
- name: Cache R packages
158+
- name: Restore Package Cache
157159
if: runner.os != 'Windows' && steps.check-rmd.outputs.count != 0
158-
uses: actions/cache@v1
160+
uses: actions/cache@v2
159161
with:
160162
path: ${{ env.R_LIBS_USER }}
161163
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
@@ -172,7 +174,7 @@ jobs:
172174
run: |
173175
while read -r cmd
174176
do
175-
eval sudo $cmd
177+
eval sudo $cmd || echo "Nothing to update"
176178
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
177179
178180
- run: make site

.github/workflows/website.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
with:
5353
r-version: 'release'
5454

55-
- name: Cache R packages
55+
- name: Restore R Cache
5656
if: steps.check-rmd.outputs.count != 0
57-
uses: actions/cache@v1
57+
uses: actions/cache@v2
5858
with:
5959
path: ${{ env.R_LIBS_USER }}
6060
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
@@ -63,8 +63,8 @@ jobs:
6363
- name: Install needed packages
6464
if: steps.check-rmd.outputs.count != 0
6565
run: |
66-
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
67-
install.packages(packages, repo="https://cran.rstudio.com/")
66+
source('bin/dependencies.R')
67+
install_required_packages()
6868
shell: Rscript {0}
6969

7070
- name: Query dependencies
@@ -73,6 +73,7 @@ jobs:
7373
source('bin/dependencies.R')
7474
deps <- identify_dependencies()
7575
create_description(deps)
76+
use_bioc_repos()
7677
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
7778
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
7879
shell: Rscript {0}
@@ -83,7 +84,7 @@ jobs:
8384
run: |
8485
while read -r cmd
8586
do
86-
eval sudo $cmd
87+
eval sudo $cmd || echo "Nothing to update"
8788
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
8889
8990
- name: Render the markdown and confirm that the site can be built

404.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ permalink: 404.html
55
title: "Page not found"
66
---
77

8-
# Oops! We can't find that page.
8+
# Oops! We cannot find that page.
99
{: style="text-align: center;"}
1010

1111
> ## Our apologies!
1212
>
13-
> We can't seem to find the page you're looking for.
13+
> We cannot seem to find the page you are looking for.
1414
> Try going back to the <a href="javascript:history.back()">previous page</a> or
1515
> navigate to any other page using the navigation bar above
1616
> {%- if site.kind == "lesson" -%} or the schedule below {%- endif -%}.

LICENSE.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ license terms.
2323

2424
Under the following terms:
2525

26-
* **Attribution**---You must give appropriate credit (mentioning that
27-
your work is derived from work that is Copyright © Software
28-
Carpentry and, where practical, linking to
29-
http://software-carpentry.org/), provide a [link to the
30-
license][cc-by-human], and indicate if changes were made. You may do
31-
so in any reasonable manner, but not in any way that suggests the
32-
licensor endorses you or your use.
26+
* **Attribution**---You must give appropriate credit by:
27+
- mentioning that your work is derived from work that is
28+
Copyright © Software Carpentry, Data Carpentry, Library Carpentry,
29+
or The Carpentries.
30+
- where practical, linking to the respective lesson program website
31+
(https://software-carpentry.org/, https://datacarpentry.org, https://librarycarpentry.org, or
32+
https://carpentries.org), provide a [link to the license][cc-by-human]
33+
- and indicate if changes were made. You may do so in any reasonable manner, but not in any way
34+
that suggests the licensor endorses you or your use.
3335

3436
**No additional restrictions**---You may not apply legal terms or
3537
technological measures that legally restrict others from doing
@@ -73,8 +75,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7375

7476
## Trademark
7577

76-
"Software Carpentry" and "Data Carpentry" and their respective logos
77-
are registered trademarks of [Community Initiatives][CI].
78+
"The Carpentries", "Software Carpentry" and "Data Carpentry" and their respective logos are
79+
registered trademarks of [Community Initiatives][CI].
7880

7981
[cc-by-human]: https://creativecommons.org/licenses/by/4.0/
8082
[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode

Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ JEKYLL=bundle config set --local path .vendor/bundle && bundle install && bundle
77
PARSER=bin/markdown_ast.rb
88
DST=_site
99

10+
# Find Docker
11+
DOCKER := $(shell which docker 2>/dev/null)
12+
1013
# Check Python 3 is installed and determine if it's called via python3 or python
1114
# (https://stackoverflow.com/a/4933395)
1215
PYTHON3_EXE := $(shell which python3 2>/dev/null)
@@ -41,23 +44,27 @@ endif
4144
.PHONY: site docker-serve repo-check clean clean-rmd
4245

4346
## * serve : render website and run a local server
44-
serve : lesson-md
47+
serve : lesson-md index.md
4548
${JEKYLL} serve
4649

4750
## * site : build website but do not run a server
48-
site : lesson-md
51+
site : lesson-md index.md
4952
${JEKYLL} build
5053

5154
## * docker-serve : use Docker to serve the site
5255
docker-serve :
53-
@docker pull carpentries/lesson-docker:latest
54-
@docker run --rm -it \
56+
ifeq (, $(DOCKER))
57+
$(error Your system does not appear to have Docker installed)
58+
else
59+
@$(DOCKER) pull carpentries/lesson-docker:latest
60+
@$(DOCKER) run --rm -it \
5561
-v $${PWD}:/home/rstudio \
5662
-p 4000:4000 \
5763
-p 8787:8787 \
5864
-e USERID=$$(id -u) \
5965
-e GROUPID=$$(id -g) \
6066
carpentries/lesson-docker:latest
67+
endif
6168

6269
## * repo-check : check repository settings
6370
repo-check : python
@@ -172,3 +179,10 @@ ifeq (, $(PYTHON))
172179
else
173180
@:
174181
endif
182+
183+
index.md :
184+
ifeq (, $(wildcard index.md))
185+
$(error index.md not found)
186+
else
187+
@:
188+
endif

_includes/base_path.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'site.url' is set to 'http://localhost:4000' and
88
'site.baseurl' is empty.
99

10-
In both of the above cases we set 'relative_root_path' to 'site.url + site.baseurl'.
10+
In both of the above cases we set 'relative_root_path' to 'site.baseurl'.
1111

1212
When we build a website locally with `jekyll build`,
1313
both 'site.url' and 'site.baseurl' are empty.
@@ -25,7 +25,7 @@
2525
{%- endcomment -%}
2626

2727
{% if site.url %}
28-
{% assign relative_root_path = site.url | append: site.baseurl %}
28+
{% assign relative_root_path = site.baseurl %}
2929
{% else %}
3030
{% assign last_char = page.url | slice: -1 %}
3131
{% if last_char == "/" %}

_includes/javascript.html

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,52 @@
44
<script src="{{ relative_root_path }}/assets/js/jquery.min.js"></script>
55
<script src="{{ relative_root_path }}/assets/js/bootstrap.min.js"></script>
66
<script src="{{ relative_root_path }}/assets/js/lesson.js"></script>
7+
8+
{% if site.kind == "lesson" %}
9+
<!-- Matomo -->
710
<script>
8-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
9-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
10-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
11-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
12-
ga('create', 'UA-37305346-2', 'auto');
13-
ga('send', 'pageview');
14-
</script>
11+
var _paq = window._paq = window._paq || [];
12+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
13+
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
14+
_paq.push(["setDomains", ["*.lessons.carpentries.org","*.datacarpentry.github.io","*.datacarpentry.org","*.librarycarpentry.github.io","*.librarycarpentry.org","*.swcarpentry.github.io"]]);
15+
_paq.push(["setDoNotTrack", true]);
16+
_paq.push(["disableCookies"]);
17+
_paq.push(['trackPageView']);
18+
_paq.push(['enableLinkTracking']);
19+
(function() {
20+
var u="https://carpentries.matomo.cloud/";
21+
_paq.push(['setTrackerUrl', u+'matomo.php']);
22+
_paq.push(['setSiteId', '1']);
23+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
24+
g.async=true; g.src='//cdn.matomo.cloud/carpentries.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
25+
})();
26+
</script>
27+
<!-- End Matomo Code -->
28+
{% endif %}
29+
30+
{% if page.math %}
31+
<script src="{{ relative_root_path }}/assets/js/katex.min.js"></script>
32+
<script>
33+
options={
34+
delimiters: [
35+
{left: "$$", right: "$$", display: true},
36+
{left: "$", right: "$", display: false},
37+
{left: "\\(", right: "\\)", display: false},
38+
{left: "\\[", right: "\\]", display: true}
39+
],
40+
output: "mathml"
41+
}
42+
</script>
43+
<script src="{{ relative_root_path }}/assets/js/katex-auto-render.min.js" onload="renderMathInElement(document.body, options)"></script>
44+
{% endif %}
45+
46+
{%- comment -%}
47+
AnchorJS: A JavaScript utility for adding deep anchor links
48+
https://github.com/bryanbraun/anchorjs
49+
https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js
50+
{%- endcomment -%}
51+
52+
<script src="{{ relative_root_path }}/assets/js/anchor.min.js"></script>
53+
<script>
54+
anchors.add();
55+
</script>

_includes/life_cycle.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,19 @@
2828
{% elsif site.life_cycle == "stable" %}
2929

3030
{% comment %}
31-
We don't do anything special for now
31+
We do not do anything special unless this is a Carpentries Lab lesson
3232
{% endcomment %}
3333

34+
{% if site.carpentry == "lab" %}
35+
{% if site.doi contains "zenodo" %}{% assign listing=" on Zenodo" %}
36+
{% elsif site.doi contains "jose" %}{% assign listing=" in JOSE" %}
37+
{% else %}{% assign listing="none" %}
38+
{% endif %}
39+
40+
<div class="panel panel-default life-cycle">
41+
<div id="life-cycle" class="panel-body published">
42+
This lesson has passed peer-review! {% if site.doi != "" %}<a href="{{ site.doi }}">See the publication{{ listing }}.</a>{% endif %}
43+
</div>
44+
</div>
45+
{% endif %}
3446
{% endif %}

_includes/manual_episode_order.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
GitHub Pages switches to Jekyll that supports it
44
without any major hackery. Note, some logic will
55
be required even when this transition happens
6-
but it won't be as involved as what we have to do
6+
but it will not be as involved as what we have to do
77
in this file.
88

99
To order lesson episodes or extras manually

_includes/navbar.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<a href="{{ site.carpentries_site }}" class="pull-left">
3333
<img class="navbar-logo" src="{{ relative_root_path }}{% link /assets/img/cp-logo-blue.svg %}" alt="The Carpentries logo" />
3434
</a>
35+
{% elsif site.carpentry == "lab" %}
36+
<a href="{{ relative_root_path }}{% link index.md %}" class="pull-left">
37+
<img class="navbar-logo" src="{{ relative_root_path }}{% link /assets/img/carpentrieslab.svg %}" alt="The Carpentries Lab" />
38+
</a>
3539
{% endif %}
3640

3741
{% comment %} Always show link to home page. {% endcomment %}
@@ -80,7 +84,9 @@
8084
{% else %}
8185
{% assign extra = lesson_extra %}
8286
{% endif %}
83-
<li><a href="{{ relative_root_path }}{{ extra.url }}">{{ extra.title }}</a></li>
87+
{% unless extra.exclude %}
88+
<li><a href="{{ relative_root_path }}{{ extra.url }}">{{ extra.title }}</a></li>
89+
{% endunless %}
8490
{% endfor %}
8591
</ul>
8692
</li>

0 commit comments

Comments
 (0)