Skip to content

Commit

Permalink
Merge pull request #662 from fmichonneau/upgrade-style-90f06fc
Browse files Browse the repository at this point in the history
Upgrade style 90f06fc
  • Loading branch information
kekoziar authored Jun 20, 2019
2 parents e68e558 + 368a8be commit fd9c9e1
Show file tree
Hide file tree
Showing 51 changed files with 1,303 additions and 849 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
indent_size = 2
indent_style = space
max_line_length = 100 # Please keep this in sync with bin/lesson_check.py!

[*.r]
max_line_length = 80

[*.py]
indent_size = 4
indent_style = space
max_line_length = 79

[*.sh]
end_of_line = lf

[Makefile]
indent_style = tab
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Please delete the text below before submitting your contribution.
Please delete this line and the text below before submitting your contribution.

---

Thanks for contributing! If this contribution is for instructor training, please send an email to checkout@carpentries.org 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.

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 Kate Hertweck (k8hertweck@gmail.com).
If this issue is about a specific episode within a lesson, please provide its link or filename.

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 team@carpentries.org.

---
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Please delete the text below before submitting your contribution.
Please delete this line and the text below before submitting your contribution.

---

Thanks for contributing! If this contribution is for instructor training, please send an email to checkout@carpentries.org 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.

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 Kate Hertweck (k8hertweck@gmail.com).
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 team@carpentries.org.

---
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "Licenses"
---
## Instructional Material

All Software Carpentry and Data Carpentry instructional material is
All Software Carpentry, Data Carpentry, and Library Carpentry instructional material is
made available under the [Creative Commons Attribution
license][cc-by-human]. The following is a human-readable summary of
(and not a substitute for) the [full legal text of the CC BY 4.0
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Settings
MAKEFILES=Makefile $(wildcard *.mk)
JEKYLL=jekyll
JEKYLL_VERSION=3.7.3
JEKYLL_VERSION=3.8.5
PARSER=bin/markdown_ast.rb
DST=_site

Expand Down Expand Up @@ -43,7 +43,7 @@ clean :
@find . -name '*.pyc' -exec rm {} \;

## clean-rmd : clean intermediate R files (that need to be committed to the repo).
clear-rmd :
clean-rmd :
@rm -rf ${RMD_DST}
@rm -rf fig/rmd-*

Expand Down Expand Up @@ -88,9 +88,8 @@ HTML_DST = \
## lesson-md : convert Rmarkdown files to markdown
lesson-md : ${RMD_DST}

# Use of .NOTPARALLEL makes rule execute only once
${RMD_DST} : ${RMD_SRC}
@bin/knit_lessons.sh ${RMD_SRC}
_episodes/%.md: _episodes_rmd/%.Rmd
@bin/knit_lessons.sh $< $@

## lesson-check : validate lesson Markdown.
lesson-check : lesson-fixme
Expand Down
24 changes: 14 additions & 10 deletions bin/boilerplate/aio.md → _includes/aio-script.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
---
{% comment %}
As a maintainer, you don't need to edit this file.
If you notice that something doesn't work, please
open an issue: https://github.com/carpentries/styles/issues/new
{% endcomment %}

<script>
window.onload = function() {
var lesson_episodes = [
Expand All @@ -12,22 +16,22 @@
xmlHttp[i] = new XMLHttpRequest();
xmlHttp[i].episode = lesson_episodes[i]; /* To enable use this later. */
xmlHttp[i].onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var article_here = document.getElementById(this.episode);
var parser = new DOMParser();
var htmlDoc = parser.parseFromString(this.responseText,"text/html");
var htmlDocArticle = htmlDoc.getElementsByTagName("article")[0];
article_here.innerHTML = htmlDocArticle.innerHTML;
if (this.readyState == 4 && this.status == 200) {
var article_here = document.getElementById(this.episode);
var parser = new DOMParser();
var htmlDoc = parser.parseFromString(this.responseText,"text/html");
var htmlDocArticle = htmlDoc.getElementsByTagName("article")[0];
article_here.innerHTML = htmlDocArticle.innerHTML;
}
}
episode_url = "{{ page.root }}" + lesson_episodes[i];
var episode_url = "{{ relative_root_path }}" + lesson_episodes[i];
xmlHttp[i].open("GET", episode_url);
xmlHttp[i].send(null);
}
}
</script>
{% comment %}
Create anchor for each one of the episodes.
Create an anchor for every episode.
{% endcomment %}
{% for episode in site.episodes %}
<article id="{{ episode.url }}"></article>
Expand Down
5 changes: 4 additions & 1 deletion _includes/all_keypoints.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{% comment %}
Display key points of all episodes for reference.
{% endcomment %}

{% include base_path.html %}

<h2>Key Points</h2>
<table class="table table-striped">
{% for episode in site.episodes %}
{% unless episode.break %}
<tr>
<td class="col-md-3">
<a href="{{ page.root }}{{ episode.url }}">{{ episode.title }}</a>
<a href="{{ relative_root_path }}{{ episode.url }}">{{ episode.title }}</a>
</td>
<td class="col-md-9">
<ul>
Expand Down
27 changes: 27 additions & 0 deletions _includes/base_path.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% comment %}
This is adapted from: https://ricostacruz.com/til/relative-paths-in-jekyll

`page.url` gives the URL of the current page with a leading /:

- when the URL ends with the extension (e.g., /foo/bar.html) then we can get
the depth by counting the number of / and remove - 1
- when the URL ends with a / (e.g. /foo/bar/) then the number / gives the depth
directly
{% endcomment %}

{% assign relative_root_path = '' %}

{% assign last_char = page.url | slice: -1 %}

{% if last_char == "/"}
{% assign offset = 0 %}
{% else %}
{% assign offset = 1 %}
{% endif %}

{% assign depth = page.url | split: '/' | size | minus: offset %}
{% if depth <= 1 %}{% assign relative_root_path = '.' %}
{% elsif depth == 2 %}{% assign relative_root_path = '..' %}
{% elsif depth == 3 %}{% assign relative_root_path = '../..' %}
{% elsif depth == 4 %}{% assign relative_root_path = '../../..' %}
{% endif %}
70 changes: 48 additions & 22 deletions _includes/carpentries.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,70 @@
{% comment %}
General description of Software and Data Carpentry.
General description of Software, Data, and Library Carpentry.
{% endcomment %}

{% include base_path.html %}

<div class="row">
<div class="col-md-2" align="center">
<a href="{{ site.swc_site }}"><img src="{{ page.root }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" /></a>
<a href="{{ site.carpentries_site }}"><img src="{{ relative_root_path }}/assets/img/cp-logo-blue.svg" alt="The Carpentries logo" /></a>
</div>
<div class="col-md-8">
Since 1998,
<a href="{{ site.swc_site }}">Software Carpentry</a>
has been teaching researchers in science, engineering, medicine, and related disciplines
the computing skills they need to get more done in less time and with less pain.
Its volunteer instructors have run hundreds of events
for thousands of learners in the past two and a half years.
<p><a href="{{ site.carpentries_site }}">The Carpentries</a> comprises
Software Carpentry, Data Carpentry, and Library Carpentry communities of Instructors, Trainers,
Maintainers, helpers, and supporters who share a mission to teach
foundational coding and data science skills to researchers and people
working in library- and information-related roles. In January,
2018, The Carpentries was formed by the merger of Software Carpentry and
Data Carpentry. Library Carpentry became an official Carpentries Lesson Program in November 2018.</p>

<p>While individual lessons and workshops continue to be run under each
lesson project, The Carpentries provide overall staffing and governance, as
well as support for assessment, instructor training and mentoring.
Memberships are joint, and the Carpentries project maintains a shared Code
of Conduct. The Carpentries is a fiscally sponsored project of Community
Initiatives, a registered 501(c)3 non-profit based in California, USA.</p>
</div>
</div>
<div class="row">
<div class="col-md-2" align="center">
<a href="{{ site.swc_site }}"><img src="{{ relative_root_path }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" /></a>
</div>
<div class="col-md-8">
<p>Since 1998, <a href="{{ site.swc_site }}">Software Carpentry</a> has
been teaching researchers across all disciplines the foundational coding
skills they need to get more done in less time and with less pain. Its
volunteer instructors have run hundreds of events for thousands of learners
around the world. Now that all research involves some degree of
computational work, whether with big data, cloud computing, or simple task
automation, these skills are needed more than ever.</p>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-2" align="center">
<a href="{{ site.dc_site }}"><img src="{{ page.root }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" /></a>
<a href="{{ site.dc_site }}"><img src="{{ relative_root_path }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" /></a>
</div>
<div class="col-md-8">
<a href="{{ site.dc_site }}">Data Carpentry</a> develops and teaches workshops on the fundamental data skills needed to conduct research.
Its target audience is researchers who have little to no prior computational experience,
and its lessons are domain specific,
building on learners' existing knowledge to enable them to quickly apply skills learned to their own research.
<p><a href="{{ site.dc_site }}">Data Carpentry</a> develops and teaches
workshops on the fundamental data skills needed to conduct research. Its
target audience is researchers who have little to no prior computational
experience, and its lessons are domain specific, building on learners'
existing knowledge to enable them to quickly apply skills learned to their
own research. Data Carpentry workshops take researchers through the entire
data life cycle.</p>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-2" align="center">
<a href="{{ site.lc_site }}"><img src="{{ page.root }}/assets/img/lc-icon-black.png" alt="Library Carpentry logo" /></a>
<a href="{{ site.lc_site }}"><img src="{{ relative_root_path }}/assets/img/lc-icon-black.png" alt="Library Carpentry logo" /></a>
</div>
<div class="col-md-8">
<a href="{{ site.lc_site }}">Library Carpentry</a> is made by librarians to help librarians
automate repetitive, boring, error-prone tasks;
create, maintain and analyse sustainable and reusable data;
work effectively with IT and systems colleagues;
better understand the use of software in research;
and much more.
Library Carpentry was the winner of the 2016
<a href="http://labs.bl.uk/British+Library+Labs+Awards">British Library Labs Teaching and Learning Award</a>.
<p><a href="{{ site.lc_site }}">Library Carpentry</a> develops lessons and
teaches workshops for and with people working in library- and
information-related roles. Its goal is to create an on-ramp to empower this
community to use software and data in their own work, as well as be
advocates for and train others in efficient, effective and reproducible data
and software practices.</p>
</div>
</div>
18 changes: 13 additions & 5 deletions _includes/episode_navbar.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
{% comment %}
For some reason, the relative_root_path seems out of scope in this file, so we
need to re-assign it here
{% endcomment %}

{% include base_path.html %}

{% comment %}
Navigation bar for an episode.
{% endcomment %}

<div class="row">
<div class="col-xs-1">
<h3 class="text-left">
{% if page.previous.url %}
<a href="{{ page.root }}{{ page.previous.url }}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span><span class="sr-only">previous episode</span></a>
<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>
{% else %}
<a href="{{ page.root }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
<a href="{{ relative_root_path }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
{% endif %}
</h3>
</div>
<div class="col-xs-10">
{% if include.episode_navbar_title %}
<h3 class="maintitle"><a href="{{ page.root }}/">{{ site.title }}</a></h3>
<h3 class="maintitle"><a href="{{ relative_root_path }}/">{{ site.title }}</a></h3>
{% endif %}
</div>
<div class="col-xs-1">
<h3 class="text-right">
{% if page.next.url %}
<a href="{{ page.root }}{{ page.next.url }}"><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span><span class="sr-only">next episode</span></a>
<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>
{% else %}
<a href="{{ page.root }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
<a href="{{ relative_root_path }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
{% endif %}
</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion _includes/favicons.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% assign favicon_url = site.baseurl | append: '/assets/favicons/' | append: site.carpentry | prepend: site.url %}
{% assign favicon_url = relative_root_path | append: '/assets/favicons/' | append: site.carpentry %}

{% if site.carpentry == 'swc' %}
{% assign carpentry = 'Software Carpentry' %}
Expand Down
45 changes: 45 additions & 0 deletions _includes/gh_variables.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% comment %}
When rendering websites locally, `site.github.url` doesn't get resolved properly
unless a GitHub Personal Access Token is set up and available in the
environment. This leads to warnings and errors when trying to serve the site
locally. To work around this, we use the `jekyll.environment` variable which is
set to `development` when rendering the site locally, and set to `production` on
GitHub where `site.github.url` is defined.
{% endcomment %}

{% if jekyll.environment == "production" %}

{% comment %}
First, get the name of the repository
{% endcomment %}
{% assign repo_name = site.github.repository_name %}

{% comment %}
`site.github.public_repositories` contains comprehensive information for all public repositories for the organization. We use `where` to extract the part
of the metadata that is relevant to the present repository.
{% endcomment %}
{% assign repo_info = site.github.public_repositories | where: "name", repo_name %}

{% comment %}
Now, we can extract the default branch for the repo
{% endcomment %}
{% assign default_branch = repo_info[0].default_branch %}

{% comment %}
Other variables requested by the template
{% endcomment %}
{% assign repo_url = site.github.repository_url %}
{% assign search_domain_url = site.github.url %}
{% assign project_title = site.github.project_title %}
{% assign source_branch = site.github.source.branch %}

{% elsif jekyll.environment == "development" %}

{% assign repo_name = "" %}
{% assign repo_url = "" %}
{% assign default_branch = "" %}
{% assign search_domain_url = "" %}
{% assign project_title = "" %}
{% assign source_branch = "" %}

{% endif %}
8 changes: 4 additions & 4 deletions _includes/javascript.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% comment %}
Javascript used in lesson and workshop pages.
JavaScript used in lesson and workshop pages.
{% endcomment %}
<script src="{{ page.root }}/assets/js/jquery.min.js"></script>
<script src="{{ page.root }}/assets/js/bootstrap.min.js"></script>
<script src="{{ page.root }}/assets/js/lesson.js"></script>
<script src="{{ relative_root_path }}/assets/js/jquery.min.js"></script>
<script src="{{ relative_root_path }}/assets/js/bootstrap.min.js"></script>
<script src="{{ relative_root_path }}/assets/js/lesson.js"></script>
<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),
Expand Down
4 changes: 2 additions & 2 deletions _includes/lc/intro.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<p>
<a href="{{site.lc_site}}">Library Carpentry</a>
is made by librarians, for librarians to help you:
is made by people working in library- and information-related roles to help you:
</p>
<ul>
<li>automate repetitive, boring, error-prone tasks</li>
<li>create, maintain and analyse sustainable and reusable data</li>
<li>create, maintain and analyze sustainable and reusable data</li>
<li>work effectively with IT and systems colleagues</li>
<li>better understand the use of software in research</li>
<li>and much more...</li>
Expand Down
Loading

0 comments on commit fd9c9e1

Please sign in to comment.