diff --git a/courses/mi-pyt/index.html b/courses/mi-pyt/index.html
index 6cf7e0e0b4..7b534a9918 100644
--- a/courses/mi-pyt/index.html
+++ b/courses/mi-pyt/index.html
@@ -15,28 +15,12 @@
Kurz MI-PYT
{% for lesson in plan %}
- {% if 'date' in lesson %}
- Lekce {{ loop.index }} - {{ lesson['name'] }}
- {% else %}
- {{ lesson['name'] }}
- {% endif %}
+ {{ lesson['name'] }}
- {% if 'description' in lesson %}
-
- {{ lesson['description'] }}
-
- {% endif %}
{% for mat in lesson['materials'] %}
- {% set done = mat.get('done', lesson.get('done', False)) %}
- {% set done_class = 'section-done' if done else 'section-todo' %}
{% endfor %}
diff --git a/courses/mi-pyt/plan.yml b/courses/mi-pyt/plan.yml
index 3510578ac0..964f809cd3 100644
--- a/courses/mi-pyt/plan.yml
+++ b/courses/mi-pyt/plan.yml
@@ -1,49 +1,14 @@
- name: Lekce
materials:
- - name: Requests a click
- type: lesson
- link: 01-requests-click
-
- - name: Flask
- type: lesson
- link: 02-flask
-
- - name: Moduly
- type: lesson
- link: 03-moduly
-
- - name: Testování
- type: lesson
- link: 04-testovani
-
- - name: Dokumentace
- type: lesson
- link: 05-dokumentace
-
- - name: Pandas
- type: lesson
- link: 06-pandas
-
- - name: Numpy
- type: lesson
- link: 07-numpy
-
- - name: Cython
- type: lesson
- link: 08-cython
-
- - name: GUI v Pythonu
- type: lesson
- link: 09-pyqt
-
- - name: Generátory a AsyncIO
- type: lesson
- link: 10-async
-
- - name: Magie
- type: lesson
- link: 11-magie
-
- - name: MicroPython
- type: lesson
- link: 12-micropython
+ - link: 01-requests-click
+ - link: 02-flask
+ - link: 03-moduly
+ - link: 04-testovani
+ - link: 05-dokumentace
+ - link: 06-pandas
+ - link: 07-numpy
+ - link: 08-cython
+ - link: 09-pyqt
+ - link: 10-async
+ - link: 11-magie
+ - link: 12-micropython
diff --git a/courses/pyladies/classes/index.html b/courses/pyladies/classes/index.html
index 894c14dd58..3fe27ef954 100644
--- a/courses/pyladies/classes/index.html
+++ b/courses/pyladies/classes/index.html
@@ -125,7 +125,7 @@ Třídy
Tady se musím omluvit:
- materiály k třetímu srazu
+ materiály k třetímu srazu
tak trochu lhaly. Funkce str,
int, float apod. totiž vůbec
nejsou funkce – jsou to právě třídy.
diff --git a/courses/pyladies/cmdline/index.html b/courses/pyladies/cmdline/index.html
index ef16b1f581..4fcad96977 100644
--- a/courses/pyladies/cmdline/index.html
+++ b/courses/pyladies/cmdline/index.html
@@ -372,7 +372,7 @@
Shrnutí
pro dnešek nám ale budou stačit tyhle.
Jen jeden ještě přidáme – příkaz python.
- Nejdřív ho ale musíme nainstalovat.
+ Nejdřív ho ale musíme nainstalovat.
diff --git a/courses/pyladies/git/index.html b/courses/pyladies/git/index.html
index f06c8bb716..98eac0ae96 100644
--- a/courses/pyladies/git/index.html
+++ b/courses/pyladies/git/index.html
@@ -58,7 +58,7 @@ Git
Budeme hodně pracovat s příkazovou řádkou.
Jestli se s ní ještě nekamarádíš, koukni se na
-
úvod.
+
úvod.
Nezapomeň:
$ na začátku se nepíše;
je tu proto, aby šlo poznat že jde o příkaz.
@@ -68,7 +68,7 @@
Git
Instalace
Popis instalace Gitu najdeš
-
zde.
+
zde.
Jestli jsi instalaci přeskočila, projdi si ji teď.
@@ -177,7 +177,7 @@
První revize
Jak na editory?
Na Windows, máš-li
- správně nastavený Git,
+ správně nastavený Git,
se použije Poznámkový blok (Notepad) – stačí něco
napsat, uložit (Ctrl+S) a zavřít
(Alt+F4).
@@ -509,7 +509,7 @@
Závěr
Zbyl-li čas, můžeme se podívat na další možnosti Gitu:
-
- Větvení a vracení
+ Větvení a vracení
se ke starším verzím
- Sdílení a spolupráce
diff --git a/courses/pyladies/github-api/index.html b/courses/pyladies/github-api/index.html
index 0615988a01..9655f074d7 100644
--- a/courses/pyladies/github-api/index.html
+++ b/courses/pyladies/github-api/index.html
@@ -8,7 +8,7 @@
Webové API
- Jak už
bylo řečeno, hlavní výhoda
+ Jak už
bylo řečeno, hlavní výhoda
formátu JSON je, že se na Internetu rozšířil nejvíc.
Pojďme toho využít!
diff --git a/courses/pyladies/index.html b/courses/pyladies/index.html
index 74bb3173c9..940f9ec3d6 100644
--- a/courses/pyladies/index.html
+++ b/courses/pyladies/index.html
@@ -15,28 +15,12 @@ Začátečnický kurz PyLadies
{% for lesson in plan %}
- {% if 'date' in lesson %}
- Lekce {{ loop.index }} - {{ lesson['name'] }}
- {% else %}
- {{ lesson['name'] }}
- {% endif %}
+ {{ lesson['name'] }}
- {% if 'description' in lesson %}
-
- {{ lesson['description'] }}
-
- {% endif %}
{% for mat in lesson['materials'] %}
- {% set done = mat.get('done', lesson.get('done', False)) %}
- {% set done_class = 'section-done' if done else 'section-todo' %}
{% endfor %}
diff --git a/courses/pyladies/inheritance/index.html b/courses/pyladies/inheritance/index.html
index f098e78d47..28ae60aefb 100644
--- a/courses/pyladies/inheritance/index.html
+++ b/courses/pyladies/inheritance/index.html
@@ -277,7 +277,7 @@ Polymorfismus
aby sis napsala vlastní zoo :)
- Nebo hru?
+ Nebo hru?
diff --git a/courses/pyladies/lists/index.html b/courses/pyladies/lists/index.html
index c69546e6e1..73a1df3c0b 100644
--- a/courses/pyladies/lists/index.html
+++ b/courses/pyladies/lists/index.html
@@ -87,7 +87,7 @@ Vybírání ze seznamů
Hranatými závorkami můžeme získávat podseznamy.
-
+
Diagram z materiálů k řetězcům
ukazuje, jak u takového „sekání” číslovat:
diff --git a/courses/pyladies/plan.yml b/courses/pyladies/plan.yml
index cffaa80fa9..0093805be5 100644
--- a/courses/pyladies/plan.yml
+++ b/courses/pyladies/plan.yml
@@ -1,120 +1,67 @@
- name: Instalace
materials:
- - name: Úvod do příkazové řádky
- type: lesson
- link: cmdline
- - name: Instalace Pythonu a první krůčky s ním
- type: lesson
- link: install
- - name: Instalace editoru
- type: lesson
- link: install_editor
- - name: Instalace Gitu
- type: lesson
- link: install_git
+ - link: cmdline
+ - link: install
+ - link: install_editor
+ - link: install_git
+
- name: První program
materials:
- - name: První program
- type: lesson
- link: hello-world
- - name: Chybové hlášky a `print`
- type: lesson
- link: printing
- - name: Proměnné
- type: lesson
- link: variables
- - name: Porovnávání
- type: lesson
- link: comparisons
- - name: "*Nebo* anebo *a*"
- type: lesson
- link: and-or
+ - link: hello-world
+ - link: printing
+ - link: variables
+ - link: comparisons
+ - link: and-or
+
- name: Cykly
materials:
- - name: Funkce
- type: lesson
- link: functions
- - name: Želva a cykly
- type: lesson
- link: turtle
- - name: Cyklus `While`
- type: lesson
- link: while
+ - link: functions
+ - link: turtle
+ - link: while
+
- name: Správa zdrojového kódu
materials:
- - name: Git
- type: lesson
- link: git
- - name: Větvení v Gitu
- type: lesson
- link: branching
+ - link: git
+ - link: branching
+
- name: Funkce & Řetězce
materials:
- - name: Vlastní funkce
- type: lesson
- link: own_functions
- - name: Řetězce
- type: lesson
- link: strings
+ - link: own_functions
+ - link: strings
+
- name: Testování
materials:
- - name: Výjimky
- type: lesson
- link: exceptions
- - name: Moduly
- type: lesson
- link: modules
- - name: Testování
- type: lesson
- link: testing
- - name: Poznámka o importování
- type: lesson
- link: circular_imports
+ - link: exceptions
+ - link: modules
+ - link: testing
+ - link: circular_imports
+
- name: Spolupráce a Open-Source
materials:
- - name: Spolupráce & Open Source
- type: lesson
- link: cooperation_and_OSS
- - name: Soubory
- type: lesson
- link: files
+ - link: cooperation_and_OSS
+ - link: files
+
- name: Seznamy
materials:
- - name: Seznamy
- type: lesson
- link: lists
- - name: N-tice
- type: lesson
- link: tuples
+ - link: lists
+ - link: tuples
+
- name: Grafika
materials:
- - name: Grafika
- type: lesson
- link: pyglet
- - name: "Praktické cvičení: Pong"
- type: lesson
- link: pong
+ - link: pyglet
+ - link: pong
+
- name: Slovníky
materials:
- - name: Slovníky
- type: lesson
- link: dicts
- - name: JSON
- type: lesson
- link: json
- - name: Github API
- type: lesson
- link: github-api
+ - link: dicts
+ - link: json
+ - link: github-api
+
- name: Třídy
materials:
- - name: Třídy
- type: lesson
- link: classes
- - name: Dědičnost
- type: lesson
- link: inheritance
+ - link: classes
+ - link: inheritance
+
- name: Závěrečný projekt
materials:
- - name: Asteroids
- type: lesson
- link: asteroids
+ - link: asteroids
diff --git a/courses/pyladies/pong/index.html b/courses/pyladies/pong/index.html
index f00079f266..8b64a68216 100644
--- a/courses/pyladies/pong/index.html
+++ b/courses/pyladies/pong/index.html
@@ -12,11 +12,11 @@
Pong
Dnes si prohloubíme znalosti programování grafických aplikací,
- které jsme získali na
minulé hodině,
+ které jsme získali na
minulé hodině,
na reálném problému.
- Naprogramujeme si s pomocí knihovny
Pyglet
+ Naprogramujeme si s pomocí knihovny
Pyglet
jednu z prvních videoher
Pong.
Pong vydala společnost
Atari
jako svůj první titul v roce 1972 a odstartovala tak boom herního průmyslu.
diff --git a/courses/pyladies/pyglet/index.html b/courses/pyladies/pyglet/index.html
index 2bc8996ea1..0a7116d256 100644
--- a/courses/pyladies/pyglet/index.html
+++ b/courses/pyladies/pyglet/index.html
@@ -587,7 +587,7 @@
Pokračování příště
ale zkus si k němu sednout, a s pomocí komentářů
ho pochopit.
Kdyby komentáře nestačily, jsou k Pongu připravené
- i
podrobné materiály.
+ i
podrobné materiály.
A chceš-li se do Pygletu ponořit hlouběji,
diff --git a/naucse/__init__.py b/naucse/__init__.py
index 74e62fa474..2218c1b8e7 100644
--- a/naucse/__init__.py
+++ b/naucse/__init__.py
@@ -5,7 +5,7 @@
from elsa import cli
from naucse.routes import app
-from naucse.templates import template_function, static, course_url, lection_url
+from naucse.templates import template_function, static, course_url, lesson_url
from naucse.filters import convert_markdown
from naucse.utils import read_yaml
diff --git a/naucse/routes.py b/naucse/routes.py
index c864b03b90..f49cecc88c 100644
--- a/naucse/routes.py
+++ b/naucse/routes.py
@@ -43,29 +43,44 @@ def courses():
@app.route('/courses/
/')
def course_page(course):
template = 'courses/{}/index.html'.format(course)
+ plan = read_yaml("courses/" + course + "/plan.yml")
+
+ lesson_dict = {}
+
+ # Load dictionary of lessons names.
+ for lesson in plan:
+ for mat in lesson['materials']:
+ if len(mat['link'].split('/')) != 1:
+ the_course = mat['link'].split('/')[0]
+ link = mat['link'].split('/')[1]
+ else:
+ link = mat['link']
+ the_course = course
+ info_file = read_yaml("courses/" + the_course + "/" + link + "/info.yml")
+ lesson_dict[mat['link']] = (the_course, info_file['title'])
try:
- return render_template(template, plan=read_yaml("courses/" + course + "/plan.yml"))
+ return render_template(template, plan=read_yaml("courses/" + course + "/plan.yml"), names=lesson_dict)
except TemplateNotFound:
abort(404)
-# Lection page.
-@app.route('/courses///', defaults={'page': 'index'})
-@app.route('/courses////')
-def course_lection(course, lection, page):
- info = read_yaml("courses/" + course + "/" + lection + "/info.yml")
- template = 'courses/{}/{}/{}.{}'.format(course, lection, page, info['style'])
+# Lesson page.
+@app.route('/courses///', defaults={'page': 'index'})
+@app.route('/courses////')
+def course_lesson(course, lesson, page):
+ info = read_yaml("courses/" + course + "/" + lesson + "/info.yml")
+ template = 'courses/{}/{}/{}.{}'.format(course, lesson, page, info['style'])
- # Static in the specific lection.
- def lection_static_url(path):
- return url_for('lection_static', course=course, lection=lection, path=path)
+ # Static in the specific lesson.
+ def lesson_static_url(path):
+ return url_for('lesson_static', course=course, lesson=lesson, path=path)
- # Link to the specific lection.
- def lection_url(lection):
- return url_for('course_lection', course=course, lection=lection, page=page)
+ # Link to the specific lesson.
+ def lesson_url(lesson):
+ return url_for('course_lesson', course=course, lesson=lesson, page=page)
file = open(template, 'r')
@@ -74,20 +89,20 @@ def lection_url(lection):
try:
if info['style'] == "md":
- return render_template('templates/markdown_page.html', static=lection_static_url, lection=lection_url, title=title, content=content)
+ return render_template('templates/markdown_page.html', static=lesson_static_url, lesson=lesson_url, title=title, content=content)
elif info['style'] == "ipynb":
- return render_template('templates/ipython_page.html', static=lection_static_url, lection=lection_url, title=title, content=content)
+ return render_template('templates/ipython_page.html', static=lesson_static_url, lesson=lesson_url, title=title, content=content)
else:
- return render_template(template, static=lection_static_url, lection=lection_url)
+ return render_template(template, static=lesson_static_url, lesson=lesson_url)
except TemplateNotFound:
abort(404)
file.close()
-# Static files in lectures.
-@app.route('/courses///static/')
-def lection_static(course, lection, path):
+# Static files in lessons.
+@app.route('/courses///static/')
+def lesson_static(course, lesson, path):
directory = os.path.join(app.root_path, 'courses')
- filename = os.path.join(course, lection, 'static', path)
+ filename = os.path.join(course, lesson, 'static', path)
return send_from_directory(directory, filename)
diff --git a/naucse/templates.py b/naucse/templates.py
index bccaa495ef..c849e808a0 100644
--- a/naucse/templates.py
+++ b/naucse/templates.py
@@ -21,5 +21,5 @@ def course_url(course):
@template_function
-def lection_url(course, lection, page='index'):
- return url_for('course_lection', course=course, lection=lection, page=page)
+def lesson_url(course, lesson, page='index'):
+ return url_for('course_lesson', course=course, lesson=lesson, page=page)