Commit 0ec69ba3 authored by Matthieu Boileau's avatar Matthieu Boileau

Merge branch 'develop' into 'master'

v0.2.3

See merge request !12
parents a2d9c4b9 27a95f4b
Pipeline #7757 passed with stage
in 1 minute and 52 seconds
......@@ -80,6 +80,12 @@ class HomePage(Page):
def _get_variables(self):
"""Set some variables from conf dictionnary and notebooks files"""
def build_link_name(link_type: str, suffix: str):
"""Build archive or pdf book links from slug name"""
if link_type in self.variables['links']:
self.variables['links'][link_type]['target'] = \
self.variables['slug_title'] + suffix
# Get chapters from notebook files
chapters = []
for nbfile in self.notebooks:
......@@ -92,6 +98,9 @@ class HomePage(Page):
chapters.append(chapter)
chapters.sort(key=lambda chapter: chapter['number'])
self.variables.update({'chapters': chapters})
build_link_name('book', '.pdf')
build_link_name('archive', '.zip')
log.debug("Homepage template variables:")
log.debug(pformat(self.variables))
......
......@@ -11,8 +11,7 @@ picture:
authors:
- name: Matthieu Boileau
email: matthieu.boileau@math.unistra.fr
- name: Vincent Legoll
email: vincentlegoll@gmail.com
- Vincent Legoll
chapter_preview_only:
- 3
- 4
......@@ -26,13 +25,11 @@ links:
target: https://mybinder.org/v2/gh/fitzinger/cours-python/master
book:
title: Version pdf
target: cours-python.pdf
gitlab:
title: Sources
target: https://gitlab.math.unistra.fr/fitzinger/cours-python
archive:
title: Archive complète
target: cours-python.zip
license:
text: Contenu mis à disposition sous licence
target: https://creativecommons.org/licenses/by-sa/4.0/
......
......@@ -68,9 +68,16 @@
<table id="auteurs">
{% for author in authors %}
<tr>
<td>{{ author.name }}</td>
{% if author.email %}
<td><a href="mailto: {{ author.email }}"><img style="display:inline" width="20" src="img/email.svg"></a></td>
<td><a href="mailto: {{ author.email }}"><img style="display:inline" width="20" src="img/email.svg"></a></td>
<td>{{ author.name }}</td>
{% else %}
<td><span style="display:none"></span></td>
{% if author is mapping %}
<td>{{ author.name }}</td>
{% else %}
<td>{{ author }}</td>
{% endif %}
{% endif %}
</tr>
{% endfor %}
......
[tool.poetry]
name = "nbcourse"
version = "0.2.2"
version = "0.2.3"
description = "Create a minisite to publish a course based on Jupyter notebooks"
authors = ["Matthieu Boileau <matthieu.boileau@math.unistra.fr>"]
license = "MIT"
......
......@@ -11,6 +11,7 @@ picture:
authors:
- name: Nobody
email: nobody@nowhere.com
- Somebody
chapter_preview_only:
- 2
links:
......@@ -22,13 +23,11 @@ links:
target: https://mybinder.org
book:
title: PDF version
target: sample-cours.pdf
gitlab:
title: Sources
target: https://gitlab.com
archive:
title: Complete archive
target: sample-course.zip
license:
text: Content available under license
target: https://creativecommons.org/licenses/by-sa/4.0/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment