Commit 714ff3d0 authored by Christian Tischer's avatar Christian Tischer

Merge branch 'carpentries-style' into 'master'

Carpentries style

See merge request grp-bio-it/image-analysis-training-resources!38
parents b617e91f 8870468f
Pipeline #10608 passed with stage
in 1 minute and 16 seconds
......@@ -2,3 +2,4 @@
.sass-cache*
Gemfile.lock
_site*
.travis.yml
image: ruby:2.5
variables:
JEKYLL_ENV: production
LC_ALL: C.UTF-8
before_script:
- bundle install
test:
stage: test
script:
- bundle exec jekyll build -d test
artifacts:
paths:
- test
- apt-get -y update
- apt-get install -y python3
- apt-get install -y python3-pip
- gem install json kramdown jekyll
- pip3 install pyyaml
pages:
stage: deploy
script:
- bundle exec jekyll build -d public
- make --always-make site
artifacts:
paths:
- public
only:
- master
- carpentries-style
- theme
FIXME: list authors' names and email addresses.
\ No newline at end of file
FIXME: describe how to cite this lesson.
\ No newline at end of file
---
layout: page
title: "Contributor Code of Conduct"
---
As contributors and maintainers of this project,
we pledge to follow the [Carpentry Code of Conduct][coc].
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by following our [reporting guidelines][coc-reporting].
{% include links.md %}
source "https://rubygems.org"
ruby RUBY_VERSION
# This will help ensure the proper Jekyll version is running.
gem "jekyll", "3.4.0"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# install GH-flavoured MD plugin
group :jekyll_plugins do
gem 'jekyll-commonmark-ghpages'
end
## ========================================
## Commands for both workshop and lesson websites.
# Settings
MAKEFILES=Makefile $(wildcard *.mk)
JEKYLL=jekyll
JEKYLL_VERSION=3.8.5
PARSER=bin/markdown_ast.rb
DST=public
# Controls
.PHONY : commands clean files
.NOTPARALLEL:
all : commands
## commands : show all commands.
commands :
@grep -h -E '^##' ${MAKEFILES} | sed -e 's/## //g'
## docker-serve : use docker to build the site
docker-serve :
docker run --rm -it -v ${PWD}:/srv/jekyll -p 127.0.0.1:4000:4000 jekyll/jekyll:${JEKYLL_VERSION} make serve
## serve : run a local server.
serve : lesson-md
${JEKYLL} serve
## site : build files but do not run a server.
site : lesson-md
${JEKYLL} build -d ${DST}
# repo-check : check repository settings.
repo-check :
@bin/repo_check.py -s .
## clean : clean up junk files.
clean :
@rm -rf ${DST}
@rm -rf .sass-cache
@rm -rf bin/__pycache__
@find . -name .DS_Store -exec rm {} \;
@find . -name '*~' -exec rm {} \;
@find . -name '*.pyc' -exec rm {} \;
## clean-rmd : clean intermediate R files (that need to be committed to the repo).
clean-rmd :
@rm -rf ${RMD_DST}
@rm -rf fig/rmd-*
## ----------------------------------------
## Commands specific to workshop websites.
.PHONY : workshop-check
## workshop-check : check workshop homepage.
workshop-check :
@bin/workshop_check.py .
## ----------------------------------------
## Commands specific to lesson websites.
.PHONY : lesson-check lesson-md lesson-files lesson-fixme
# RMarkdown files
RMD_SRC = $(wildcard _episodes_rmd/??-*.Rmd)
RMD_DST = $(patsubst _episodes_rmd/%.Rmd,_episodes/%.md,$(RMD_SRC))
# Lesson source files in the order they appear in the navigation menu.
MARKDOWN_SRC = \
index.md \
CODE_OF_CONDUCT.md \
setup.md \
$(sort $(wildcard _episodes/*.md)) \
reference.md \
$(sort $(wildcard _extras/*.md)) \
LICENSE.md
# Generated lesson files in the order they appear in the navigation menu.
HTML_DST = \
${DST}/index.html \
${DST}/conduct/index.html \
${DST}/setup/index.html \
$(patsubst _episodes/%.md,${DST}/%/index.html,$(sort $(wildcard _episodes/*.md))) \
${DST}/reference/index.html \
$(patsubst _extras/%.md,${DST}/%/index.html,$(sort $(wildcard _extras/*.md))) \
${DST}/license/index.html
## lesson-md : convert Rmarkdown files to markdown
lesson-md : ${RMD_DST}
_episodes/%.md: _episodes_rmd/%.Rmd
@bin/knit_lessons.sh $< $@
## lesson-check : validate lesson Markdown.
lesson-check : lesson-fixme
@bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
## lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace.
lesson-check-all :
@bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
## unittest : run unit tests on checking tools.
unittest :
@bin/test_lesson_check.py
## lesson-files : show expected names of generated files for debugging.
lesson-files :
@echo 'RMD_SRC:' ${RMD_SRC}
@echo 'RMD_DST:' ${RMD_DST}
@echo 'MARKDOWN_SRC:' ${MARKDOWN_SRC}
@echo 'HTML_DST:' ${HTML_DST}
## lesson-fixme : show FIXME markers embedded in source files.
lesson-fixme :
@fgrep -i -n FIXME ${MARKDOWN_SRC} || true
#-------------------------------------------------------------------------------
# Include extra commands if available.
#-------------------------------------------------------------------------------
-include commands.mk
title: Image Analysis Training
email: image-analysis-support@embl.de
title: "Image Analysis Training"
email: "image-analysis-support@embl.de"
description: > # this means to ignore newlines until "baseurl:"
A collection of material for teaching image analysis.
Includes concept maps, exercises, example data
......@@ -8,11 +8,49 @@ url: "https://grp-bio-it.embl-community.io/" # the base hostname & protocol for
contributing: CONTRIBUTING
# Build settings
markdown: CommonMarkGhPages
commonmark:
options: ["SMART"]
# Turn on built-in syntax highlighting.
highlighter: rouge
exclude: ["README.md", "TEACHING.md"]
# options are: "NONE", "ImageJ GUI", "ImageJ Macro", "Jython", "MATLAB"
default-platform: "NONE"
life_cycle: "pre-alpha"
kind: "lesson"
# Sites
repo_url: "https://git.embl.de/grp-bio-it/image-analysis-training-resources"
cc_by_human: "https://creativecommons.org/licenses/by/4.0/"
# Specify that things in the episodes collection should be output.
collections:
modules:
output: true
permalink: /:path/index.html
extras:
output: true
permalink: /:path/index.html
# Set the default layout for things in the modules collection.
defaults:
- values:
root: .
layout: page
- scope:
path: ""
type: modules
values:
root: ..
layout: module
- scope:
path: ""
type: extras
values:
root: ..
layout: page
# Files and directories that are not to be copied.
exclude:
- Makefile
- bin/
- .Rproj.user/
---
title: About
---
{% include carpentries.html %}
{% include links.md %}
---
title: Discussion
---
FIXME
{% include links.md %}
---
title: Figures
---
{% include base_path.html %}
<script>
window.onload = function() {
var lesson_episodes = [
{% for episode in site.episodes %}
"{{ episode.url }}"{% unless forloop.last %},{% endunless %}
{% endfor %}
];
var xmlHttp = []; /* Required since we are going to query every episode. */
for (i=0; i < lesson_episodes.length; i++) {
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 parser = new DOMParser();
var htmlDoc = parser.parseFromString(this.responseText,"text/html");
var htmlDocArticle = htmlDoc.getElementsByTagName("article")[0];
var article_here = document.getElementById(this.episode);
var images = htmlDocArticle.getElementsByTagName("img");
if (images.length > 0) {
var h1text = htmlDocArticle.getElementsByTagName("h1")[0].innerHTML;
var htitle = document.createElement('h2');
htitle.innerHTML = h1text;
article_here.appendChild(htitle);
var image_num = 0;
for (let image of images) {
image_num++;
var title = document.createElement('p');
title.innerHTML = "<strong>Figure " + image_num + ".</strong> " + image.alt;
article_here.appendChild(title);
article_here.appendChild(image.cloneNode(false));
if (image_num < images.length) {
var hr = document.createElement('hr');
article_here.appendChild(hr);
}
}
}
}
}
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.
{% endcomment %}
{% for episode in site.episodes %}
<article id="{{ episode.url }}" class="figures"></article>
{% endfor %}
{% include links.md %}
---
title: "Instructor Notes"
---
FIXME
{% include links.md %}
{% 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 = [
{% for episode in site.episodes %}
"{{ episode.url}}"{% unless forloop.last %},{% endunless %}
{% endfor %}
];
var xmlHttp = []; /* Required since we are going to query every episode. */
for (i=0; i < lesson_episodes.length; i++) {
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;
}
}
var episode_url = "{{ relative_root_path }}" + lesson_episodes[i];
xmlHttp[i].open("GET", episode_url);
xmlHttp[i].send(null);
}
}
</script>
{% comment %}
Create an anchor for every episode.
{% endcomment %}
{% for episode in site.episodes %}
<article id="{{ episode.url }}"></article>
{% endfor %}
{% 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="{{ relative_root_path }}{{ episode.url }}">{{ episode.title }}</a>
</td>
<td class="col-md-9">
<ul>
{% for keypoint in episode.keypoints %}
<li>{{ keypoint|markdownify }}</li>
{% endfor %}
</ul>
</td>
</tr>
{% endunless %}
{% endfor %}
</table>
{% 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 %}
......@@ -4,18 +4,16 @@ This file should contain language-specific exercises, *written* in **Markdown**
#### Exercise 1
What is the solution to the first exercise?
What is the solution to the first exercise?
<details>
<summary>Solution</summary>
This is the solution to the first exercise.
</details>
> ## Solution
> This is the solution to the first exercise.
{: .solution}
#### Exercise 2
What is the solution to the second exercise?
<details>
<summary>Solution</summary>
This is the solution to the second exercise.
</details>
> ## Solution
> This is the solution to the second exercise.
{: .solution}
{% comment %}
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.carpentries_site }}"><img src="{{ relative_root_path }}/assets/img/cp-logo-blue.svg" alt="The Carpentries logo" /></a>
</div>
<div class="col-md-8">
<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="{{ relative_root_path }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" /></a>
</div>
<div class="col-md-8">
<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="{{ relative_root_path }}/assets/img/lc-icon-black.png" alt="Library Carpentry logo" /></a>
</div>
<div class="col-md-8">
<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>
<p>
<a href="{{site.dc_site}}">Data Carpentry</a>
aims to help researchers get their work done
in less time and with less pain
by teaching them basic research computing skills.
This hands-on workshop will cover basic concepts and tools,
including program design, version control, data management,
and task automation.
Participants will be encouraged to help one another
and to apply what they have learned to their own research problems.
</p>
<p align="center">
<em>
For more information on what we teach and why,
please see our paper
"<a href="http://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.1001745">Best Practices for Scientific Computing</a>".
</em>
</p>
<div class="row">
<div class="col-md-6">
<h3>Day 1</h3>
<table class="table table-striped">
<tr> <td>09:00</td> <td>Automating tasks with the Unix shell</td> </tr>
<tr> <td>10:30</td> <td>Coffee</td> </tr>
<tr> <td>12:00</td> <td>Lunch break</td> </tr>
<tr> <td>13:00</td> <td>Building programs with Python</td> </tr>
<tr> <td>14:30</td> <td>Coffee</td> </tr>
<tr> <td>16:00</td> <td>Wrap-up</td> </tr>
</table>
</div>
<div class="col-md-6">
<h3>Day 2</h3>
<table class="table table-striped">
<tr> <td>09:00</td> <td>Version control with Git</td> </tr>
<tr> <td>10:30</td> <td>Coffee</td> </tr>
<tr> <td>12:00</td> <td>Lunch break</td> </tr>
<tr> <td>13:00</td> <td>Managing data with SQL</td> </tr>
<tr> <td>14:30</td> <td>Coffee</td> </tr>
<tr> <td>16:00</td> <td>Wrap-up</td> </tr>
</table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3 id="syllabus-shell">The Unix Shell</h3>
<ul>
<li>Files and directories</li>
<li>History and tab completion</li>
<li>Pipes and redirection</li>
<li>Looping over files</li>
<li>Creating and running shell scripts</li>
<li>Finding things</li>
<li><a href="{{site.swc_pages}}/shell-novice/reference/">Reference...</a></li>
</ul>
</div>
<div class="col-md-6">
<h3 id="syllabus-python">Programming in Python</h3>
<ul>
<li>Using libraries</li>
<li>Working with arrays</li>
<li>Reading and plotting data</li>
<li>Creating and using functions</li>
<li>Loops and conditionals</li>
<li>Defensive programming</li>
<li>Using Python from the command line</li>
<li><a href="{{site.swc_pages}}/python-novice-inflammation/reference/">Reference...</a></li>
</ul>
</div>
<!--
<div class="col-md-6">
<h3 id="syllabus-r">Programming in R</h3>
<ul>
<li>Working with vectors and data frames</li>
<li>Reading and plotting data</li>
<li>Creating and using functions</li>
<li>Loops and conditionals</li>
<li>Using R from the command line</li>
<li><a href="{{site.swc_pages}}/r-novice-inflammation/reference/">Reference...</a></li>
</ul>
</div>
-->
<!--
<div class="col-md-6">
<h3 id="syllabus-matlab">Programming in MATLAB</h3>
<ul>
<li>Working with arrays</li>
<li>Reading and plotting data</li>
<li>Creating and using functions</li>
<li>Loops and conditionals</li>
<li>Defensive programming</li>
<li><a href="{{site.swc_pages}}/matlab-novice-inflammation/reference/">Reference...</a></li>
</ul>
</div>
-->
</div>
<div class="row">
<div class="col-md-6">
<h3 id="syllabus-git">Version Control with Git</h3>
<ul>
<li>Creating a repository</li>
<li>Recording changes to files: <code>add</code>, <code>commit</code>, ...</li>
<li>Viewing changes: <code>status</code>, <code>diff</code>, ...</li>
<li>Ignoring files</li>
<li>Working on the web: <code>clone</code>, <code>pull</code>, <code>push</code>, ...</li>
<li>Resolving conflicts</li>
<li>Open licenses</li>
<li>Where to host work, and why</li>
<li><a href="{{site.swc_pages}}/git-novice/reference/">Reference...</a></li>
</ul>
</div>
<!--
<div class="col-md-6">
<h3 id="syllabus-sql">Managing Data with SQL</h3>
<ul>
<li>Reading and sorting data</li>
<li>Filtering with <code>where</code></li>
<li>Calculating new values on the fly</li>