From 311d9303fc9309dc42e68add67f9947237dc2024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Michonneau?= Date: Fri, 1 Nov 2019 14:40:50 +0100 Subject: [PATCH 1/6] use jekyll to generate all in one --- _includes/aio-script.md | 55 +++++++++----------------------- _includes/episode_keypoints.html | 9 +++++- _includes/episode_overview.html | 34 +++++++++++++++++--- 3 files changed, 53 insertions(+), 45 deletions(-) diff --git a/_includes/aio-script.md b/_includes/aio-script.md index a81fbcdd..24d81c69 100644 --- a/_includes/aio-script.md +++ b/_includes/aio-script.md @@ -1,50 +1,25 @@ {% comment %} As a maintainer, you don't need to edit this file. -If you notice that something doesn't work, please +If you notice that something doesn't work, please open an issue: https://github.com/carpentries/styles/issues/new {% endcomment %} {% include manual_episode_order.html %} - +{% for lesson_episode in lesson_episodes %} -{% comment %} Create an anchor for every episode. {% endcomment %} +{% if site.episode_order %} + {% assign e = site.episodes | where: "slug", lesson_episode | first %} +{% else %} + {% assign e = lesson_episode %} +{% endif %} -{% for lesson_episode in lesson_episodes %} - {% if site.episode_order %} - {% assign episode = site.episodes | where: "slug", lesson_episode | first %} - {% else %} - {% assign episode = lesson_episode %} - {% endif %} -
+

{{ e.title }}

+ +{% include episode_overview.html teaching_time=e.teaching exercise_time=e.exercises episode_questions=e.questions episode_objectives=e.objectives %} + +{{ e.content }} + +{% include episode_keypoints.html episode_keypoints=e.keypoints %} +
{% endfor %} diff --git a/_includes/episode_keypoints.html b/_includes/episode_keypoints.html index 2baa53ef..64abecef 100644 --- a/_includes/episode_keypoints.html +++ b/_includes/episode_keypoints.html @@ -1,10 +1,17 @@ {% comment %} Display key points for an episode. {% endcomment %} + +{% if page.keypoints == null %} +{% assign episode_keypoints = include.episode_keypoints %} +{% else %} +{% assign episode_keypoints = page.keypoints %} +{% endif %} +

Key Points

diff --git a/_includes/episode_overview.html b/_includes/episode_overview.html index cb87e0f6..b15c8d1e 100644 --- a/_includes/episode_overview.html +++ b/_includes/episode_overview.html @@ -1,19 +1,45 @@ {% comment %} Display an episode's timings and learning objectives. {% endcomment %} + +{% if page.teaching == null %} +{% assign teaching_time = include.teaching_time %} +{% else %} +{% assign teaching_time = page.teaching %} +{% endif %} + +{% if page.exercises == null %} +{% assign exercise_time = include.exercise_time %} +{% else %} +{% assign exercise_time = page.exercises %} +{% endif %} + +{% if page.questions == null %} +{% assign episode_questions = include.episode_questions %} +{% else %} +{% assign episode_questions = page.questions %} +{% endif %} + +{% if page.objectives == null %} +{% assign episode_objectives = include.episode_objectives %} +{% else %} +{% assign episode_objectives = page.objectives %} +{% endif %} + +

Overview

- Teaching: {{ page.teaching }} min + Teaching: {{ teaching_time }} min
- Exercises: {{ page.exercises }} min + Exercises: {{ exercise_time }} min
Questions
    - {% for question in page.questions %} + {% for question in episode_questions %}
  • {{ question|markdownify }}
  • {% endfor %}
@@ -26,7 +52,7 @@

Overview

Objectives
    - {% for objective in page.objectives %} + {% for objective in episode_objectives %}
  • {{ objective|markdownify }}
  • {% endfor %}
From 322b51ddf74bb04892e993eac2effef58010456a Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Fri, 8 Nov 2019 15:14:35 -0600 Subject: [PATCH 2/6] _includes/aio-script.md cleanup --- _includes/aio-script.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/aio-script.md b/_includes/aio-script.md index 24d81c69..d90e6d68 100644 --- a/_includes/aio-script.md +++ b/_includes/aio-script.md @@ -1,6 +1,6 @@ {% comment %} As a maintainer, you don't need to edit this file. -If you notice that something doesn't work, please +If you notice that something doesn't work, please open an issue: https://github.com/carpentries/styles/issues/new {% endcomment %} @@ -21,5 +21,5 @@ open an issue: https://github.com/carpentries/styles/issues/new {{ e.content }} {% include episode_keypoints.html episode_keypoints=e.keypoints %} -
+
{% endfor %} From 25d911562903595413f31bb99a3fc27fefce2c9e Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Fri, 8 Nov 2019 15:15:06 -0600 Subject: [PATCH 3/6] includes/episode_keypoints.html: null -> nil --- _includes/episode_keypoints.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/episode_keypoints.html b/_includes/episode_keypoints.html index 64abecef..5c283ea8 100644 --- a/_includes/episode_keypoints.html +++ b/_includes/episode_keypoints.html @@ -2,7 +2,7 @@ Display key points for an episode. {% endcomment %} -{% if page.keypoints == null %} +{% if page.keypoints == nil %} {% assign episode_keypoints = include.episode_keypoints %} {% else %} {% assign episode_keypoints = page.keypoints %} From b847cf4a663316f636f5fd3baf12c19ca1aaf1ea Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Fri, 8 Nov 2019 15:15:35 -0600 Subject: [PATCH 4/6] includes/episode_overview.html: null -> nil --- _includes/episode_overview.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_includes/episode_overview.html b/_includes/episode_overview.html index b15c8d1e..cc2bb069 100644 --- a/_includes/episode_overview.html +++ b/_includes/episode_overview.html @@ -2,25 +2,25 @@ Display an episode's timings and learning objectives. {% endcomment %} -{% if page.teaching == null %} +{% if page.teaching == nil %} {% assign teaching_time = include.teaching_time %} {% else %} {% assign teaching_time = page.teaching %} {% endif %} -{% if page.exercises == null %} +{% if page.exercises == nil %} {% assign exercise_time = include.exercise_time %} {% else %} {% assign exercise_time = page.exercises %} {% endif %} -{% if page.questions == null %} +{% if page.questions == nil %} {% assign episode_questions = include.episode_questions %} {% else %} {% assign episode_questions = page.questions %} {% endif %} -{% if page.objectives == null %} +{% if page.objectives == nil %} {% assign episode_objectives = include.episode_objectives %} {% else %} {% assign episode_objectives = page.objectives %} From 369a04ffcffc871b1301953c5fd587fa9b17feca Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Fri, 8 Nov 2019 15:47:43 -0600 Subject: [PATCH 5/6] _includes/episode_overview.html: explain why we need 'if' statements --- _includes/episode_overview.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/_includes/episode_overview.html b/_includes/episode_overview.html index cc2bb069..6d299f53 100644 --- a/_includes/episode_overview.html +++ b/_includes/episode_overview.html @@ -1,5 +1,16 @@ {% comment %} - Display an episode's timings and learning objectives. + Display episode's timings and learning objectives. + + Regarding the `if page.*** == nil` below: + all-in-one page combines all episodes into one. + It, therefore, does not define its own objectives, exercises, + and questions, which 'normal' episodes define in the front matter. + + To display episodes' teaching and exercise times, as well as episode + questions and objectives, we pass them as parameters to the Liquid's + `include` statement when we generate the page: + + {% include episode_overview.html teaching_time=e.teaching ... %} {% endcomment %} {% if page.teaching == nil %} From ff283a6f4b762c603e41e54b6c1f417e96fa9ea3 Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Fri, 8 Nov 2019 15:57:55 -0600 Subject: [PATCH 6/6] _includes/episode_overview.html: update explanation of the if statements --- _includes/episode_overview.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/_includes/episode_overview.html b/_includes/episode_overview.html index 6d299f53..c4a4d482 100644 --- a/_includes/episode_overview.html +++ b/_includes/episode_overview.html @@ -11,6 +11,9 @@ `include` statement when we generate the page: {% include episode_overview.html teaching_time=e.teaching ... %} + + Here we obtain the information we need either from the episode itself or + from the parameters passed in. {% endcomment %} {% if page.teaching == nil %}