Skip to content

Commit

Permalink
Merge pull request #1033 from swcarpentry/update-styles-final
Browse files Browse the repository at this point in the history
Update to final version of styles lesson template
  • Loading branch information
ineelhere authored Apr 14, 2023
2 parents 5337d8d + 799fedc commit f00c9cf
Show file tree
Hide file tree
Showing 21 changed files with 581 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Thanks for contributing! :heart:

If this contribution is for instructor training, please email the link to this contribution to
checkout@carpentries.org so we can record your progress. You've completed your contribution
instructor.training@carpentries.org so we can record your progress. You've completed your contribution
step for instructor checkout by submitting this contribution!

Keep in mind that **lesson maintainers are volunteers** and it may take them some time to
Expand Down
4 changes: 2 additions & 2 deletions 404.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ permalink: 404.html
title: "Page not found"
---

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

> ## Our apologies!
>
> We can't seem to find the page you're looking for.
> We cannot seem to find the page you are looking for.
> Try going back to the <a href="javascript:history.back()">previous page</a> or
> navigate to any other page using the navigation bar above
> {%- if site.kind == "lesson" -%} or the schedule below {%- endif -%}.
Expand Down
20 changes: 11 additions & 9 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ license terms.

Under the following terms:

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

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

## Trademark

"Software Carpentry" and "Data Carpentry" and their respective logos
are registered trademarks of [Community Initiatives][CI].
"The Carpentries", "Software Carpentry" and "Data Carpentry" and their respective logos are
registered trademarks of [Community Initiatives][CI].

[cc-by-human]: https://creativecommons.org/licenses/by/4.0/
[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode
Expand Down
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ JEKYLL=bundle config set --local path .vendor/bundle && bundle install && bundle
PARSER=bin/markdown_ast.rb
DST=_site

# Find Docker
DOCKER := $(shell which docker 2>/dev/null)

# Check Python 3 is installed and determine if it's called via python3 or python
# (https://stackoverflow.com/a/4933395)
PYTHON3_EXE := $(shell which python3 2>/dev/null)
Expand Down Expand Up @@ -41,23 +44,27 @@ endif
.PHONY: site docker-serve repo-check clean clean-rmd

## * serve : render website and run a local server
serve : lesson-md
serve : lesson-md index.md
${JEKYLL} serve

## * site : build website but do not run a server
site : lesson-md
site : lesson-md index.md
${JEKYLL} build

## * docker-serve : use Docker to serve the site
docker-serve :
@docker pull carpentries/lesson-docker:latest
@docker run --rm -it \
ifeq (, $(DOCKER))
$(error Your system does not appear to have Docker installed)
else
@$(DOCKER) pull carpentries/lesson-docker:latest
@$(DOCKER) run --rm -it \
-v $${PWD}:/home/rstudio \
-p 4000:4000 \
-p 8787:8787 \
-e USERID=$$(id -u) \
-e GROUPID=$$(id -g) \
carpentries/lesson-docker:latest
endif

## * repo-check : check repository settings
repo-check : python
Expand Down Expand Up @@ -172,3 +179,10 @@ ifeq (, $(PYTHON))
else
@:
endif

index.md :
ifeq (, $(wildcard index.md))
$(error index.md not found)
else
@:
endif
22 changes: 22 additions & 0 deletions _includes/check_transition_variables.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% assign date = include.need_transition_date %}

{% if date == "true" %}
{% unless site.transition_date_prebeta %}
<div class="alert alert-danger">
you need to specify the variable <code>transition_date_prebeta</code>
in <code>_config.yml</code>.
</div>
{% endunless %}
{% unless site.transition_date_beta %}
<div class="alert alert-danger">
you need to specify the variable <code>transition_date_beta</code>
in <code>_config.yml</code>.
</div>
{% endunless %}
{% unless site.transition_date_prerelease %}
<div class="alert alert-danger">
you need to specify the variable <code>transition_date_prerelease</code>
in <code>_config.yml</code>.
</div>
{% endunless %}
{% endif %}
25 changes: 19 additions & 6 deletions _includes/javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,27 @@
<script src="{{ relative_root_path }}/assets/js/bootstrap.min.js"></script>
<script src="{{ relative_root_path }}/assets/js/lesson.js"></script>

{% if site.kind == "lesson" %}
<!-- Matomo -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-37305346-2', 'auto');
ga('send', 'pageview');
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setDomains", ["*.lessons.carpentries.org","*.datacarpentry.github.io","*.datacarpentry.org","*.librarycarpentry.github.io","*.librarycarpentry.org","*.swcarpentry.github.io"]]);
_paq.push(["setDoNotTrack", true]);
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://carpentries.matomo.cloud/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='//cdn.matomo.cloud/carpentries.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
{% endif %}

{% if page.math %}
<script src="{{ relative_root_path }}/assets/js/katex.min.js"></script>
Expand Down
17 changes: 10 additions & 7 deletions _includes/lesson_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
{% endif %}
</div>
<div class="col-md-6 help-links" align="right">
{% if page.source %}
{% if page.source == "Rmd" %}
<a href="{{repo_url}}/edit/{{ default_branch }}/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}" data-checker-ignore>Edit on GitHub</a>
{% endif %}
{% else %}
<a href="{{repo_url}}/edit/{{ default_branch }}/{{page.path}}" data-checker-ignore>Edit on GitHub</a>
{% endif %}
{% if site.life_cycle == 'transition-step-2' %}
{% assign edit_url = "https://carpentries.github.io/workbench/contributor/beta.html?id=" | append: repo_url %}
{% else %}
{% assign edit_url = repo_url %}
{% endif %}
{% if page.source == "Rmd" %}
<a href="{{edit_url}}/edit/{{ default_branch }}/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}" data-checker-ignore>Edit on GitHub</a>
{% else %}
<a href="{{edit_url}}/edit/{{ default_branch }}/{{page.path}}" data-checker-ignore>Edit on GitHub</a>
{% endif %}
/
<a href="{{ repo_url }}/blob/{{ source_branch }}/CONTRIBUTING.md" data-checker-ignore>Contributing</a>
/
Expand Down
61 changes: 60 additions & 1 deletion _includes/life_cycle.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,66 @@
{% elsif site.life_cycle == "stable" %}

{% comment %}
We don't do anything special for now
We do not do anything special for lessons in stable
{% endcomment %}


{% comment %}
Below we cover the 2 phases of lesson transition towards the Carpentries Workbench:
Variables needed:
- transition_date_prebeta: the date of the prebeta stage
- transition_date_beta: the date of the beta stage
- transition_date_prerelease: the date of the prerelease stage

- transition-step-1: We notify that there is a snapshot of the lesson available for testing, and that it will supersede this version.
- transition-step-2 We indicate that this version of the lesson is a snapshot and a new version of the lesson is avaiable and will supersede this version at a given date.
{% endcomment %}

{% elsif site.life_cycle == "transition-step-1" %}
{% include check_transition_variables.html need_transition_date = 'true' %}

<div id="life-cycle" class="alert alert-warning life-cycle panel-body">
A snapshot of this lesson from {{ site.transition_date_prebeta }} is being tested on
<a href='https://carpentries.github.io/workbench'>The Carpentries Workbench</a>:
<a href="https://preview.carpentries.org/{{ repo_name }}">https://preview.carpentries.org/{{ repo_name }}</a>.
<br>
<b>The Workbench version of this lesson will become default on {{ site.transition_date_prerelease }}</b>.
<button type="button" style="border: true; position: absolute; top: 10px; right: 27px; color: #383838;" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true" style='font-size:34pt'>&times;</span>
</button>
</div>

{% elsif site.life_cycle == "transition-step-2" %}
{% include check_transition_variables.html need_transition_date = 'true' %}

<div id="life-cycle" class="alert alert-danger alert-dismissible life-cycle panel-body" role="alert">
This lesson is a <b>snapshot from {{ site.transition_date_beta }}</b>.
A newer version is being tested on <a href='https://carpentries.github.io/workbench'>The Carpentries Workbench</a>:
<a href="https://preview.carpentries.org/{{ repo_name }}">https://preview.carpentries.org/{{ repo_name }}</a>.
<br>
<b>The Workbench version of this lesson will become default on {{ site.transition_date_prerelease }}</b>.
<button type="button" style="border: true; position: absolute; top: 10px; right: 27px; color: #383838;" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true" style='font-size:34pt'>&times;</span>
</button>
</div>

{% endif %}



{% comment %}
For Carpentries Lab lessons we add a banner about the review status
{% endcomment %}

{% if site.carpentry == "lab" %}
{% if site.doi contains "zenodo" %}{% assign listing=" on Zenodo" %}
{% elsif site.doi contains "jose" %}{% assign listing=" in JOSE" %}
{% else %}{% assign listing="none" %}
{% endif %}

<div class="panel panel-default life-cycle">
<div id="life-cycle" class="panel-body published">
This lesson has passed peer-review! {% if site.doi != "" %}<a href="{{ site.doi }}">See the publication{{ listing }}.</a>{% endif %}
</div>
</div>
{% endif %}
2 changes: 1 addition & 1 deletion _includes/manual_episode_order.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
GitHub Pages switches to Jekyll that supports it
without any major hackery. Note, some logic will
be required even when this transition happens
but it won't be as involved as what we have to do
but it will not be as involved as what we have to do
in this file.

To order lesson episodes or extras manually
Expand Down
22 changes: 16 additions & 6 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<a href="{{ site.carpentries_site }}" class="pull-left">
<img class="navbar-logo" src="{{ relative_root_path }}{% link /assets/img/cp-logo-blue.svg %}" alt="The Carpentries logo" />
</a>
{% elsif site.carpentry == "lab" %}
<a href="{{ relative_root_path }}{% link index.md %}" class="pull-left">
<img class="navbar-logo" src="{{ relative_root_path }}{% link /assets/img/carpentrieslab.svg %}" alt="The Carpentries Lab" />
</a>
{% endif %}

{% comment %} Always show link to home page. {% endcomment %}
Expand Down Expand Up @@ -80,20 +84,26 @@
{% else %}
{% assign extra = lesson_extra %}
{% endif %}
<li><a href="{{ relative_root_path }}{{ extra.url }}">{{ extra.title }}</a></li>
{% unless extra.exclude %}
<li><a href="{{ relative_root_path }}{{ extra.url }}">{{ extra.title }}</a></li>
{% endunless %}
{% endfor %}
</ul>
</li>
{% endif %}

{% comment %} Always show license. {% endcomment %}
<li><a href="{{ relative_root_path }}{% link LICENSE.md %}">License</a></li>
{% if page.source %}
{% if page.source == "Rmd" %}
<li><a href="{{repo_url}}/edit/{{ default_branch }}/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}" data-checker-ignore>Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
{% endif %}
{% if site.life_cycle == 'transition-step-2' %}
{% assign edit_url = "https://carpentries.github.io/workbench/contributor/beta.html?id=" | append: repo_url %}
{% else %}
{% assign edit_url = repo_url %}
{% endif %}

{% if page.source == "Rmd" %}
<li><a href="{{edit_url}}/edit/{{ default_branch }}/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}" data-checker-ignore>Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
{% else %}
<li><a href="{{repo_url}}/edit/{{ default_branch}}/{{page.path}}" data-checker-ignore>Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
<li><a href="{{edit_url}}/edit/{{ default_branch }}/{{page.path}}" data-checker-ignore>Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
{% endif %}
</ul>
<form class="navbar-form navbar-right" role="search" id="search" onsubmit="google_search(); return false;">
Expand Down
19 changes: 19 additions & 0 deletions _includes/syllabus.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ <h2 id="schedule">Schedule</h2>
<td class="col-md-3"><a href="{{ relative_root_path }}{% link setup.md %}">Setup</a></td>
<td class="col-md-7">Download files required for the lesson</td>
</tr>
{% if site.instructor_training %}
<tr>
{% if multiday %}<td class="col-md-1"></td>{% endif %}
<td class="{% if multiday %}col-md-1{% else %}col-md-2{% endif %}"></td>
<td class="col-md-3"><a href="{{ site.instructor_pre_survey }}{{ site.github.project_title }}">Pre-training survey</a></td>
<td class="col-md-7">Please fill out our pre-training survey before the start of the course.</td>
</tr>
{% endif %}
{% for lesson_episode in lesson_episodes %}
{% if site.episode_order %}
{% assign episode = site.episodes | where: "slug", lesson_episode | first %}
Expand Down Expand Up @@ -78,6 +86,17 @@ <h2 id="schedule">Schedule</h2>
{% endfor %}
{% assign hours = current | divided_by: 60 %}
{% assign minutes = current | modulo: 60 %}
{% if site.instructor_training %}
<tr>
{% if multiday %}<td class="col-md-1"></td>{% endif %}
<td class="{% if multiday %}col-md-1{% else %}col-md-2{% endif %}">{% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif +++ %}{{ minutes }}</td>
<td class="col-md-3"><a href="{{ site.instructor_post_survey }}{{ site.github.project_title }}">Post-training survey</a></td>
<td class="col-md-7">Please fill out our post-training survey after the course.</td>
</tr>
{% assign current = current | plus: 15 %}
{% assign hours = current | divided_by: 60 %}
{% assign minutes = current | modulo: 60 %}
{% endif %}
<tr>
{% if multiday %}<td class="col-md-1"></td>{% endif %}
<td class="{% if multiday %}col-md-1{% else %}col-md-2{% endif %}">{% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif %}{{ minutes }}</td>
Expand Down
2 changes: 1 addition & 1 deletion _layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<title>
{% if page.title %}{{ page.title }}{% endif %}{% if page.title and site.title %} &ndash; {% endif %}{% if site.title %}{{ site.title }}{% endif %}
</title>
</title>

</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions aio.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ permalink: /aio/index.html
---

{% comment %}
As a maintainer, you don't need to edit this file.
If you notice that something doesn't work, please
As a maintainer, you do not need to edit this file.
If you notice that something does not work, please
open an issue: https://github.com/carpentries/styles/issues/new
{% endcomment %}

Expand Down
Loading

0 comments on commit f00c9cf

Please sign in to comment.