From 39003e87f5779e50783a03732bdb841728b5884b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20Krej=C4=8D=C3=AD?= Date: Fri, 13 Jan 2017 16:07:59 +0100 Subject: [PATCH 1/4] lection -> lesson --- courses/mi-pyt/index.html | 2 +- courses/pyladies/classes/index.html | 2 +- courses/pyladies/cmdline/index.html | 2 +- courses/pyladies/git/index.html | 8 +++--- courses/pyladies/github-api/index.html | 2 +- courses/pyladies/index.html | 2 +- courses/pyladies/inheritance/index.html | 2 +- courses/pyladies/lists/index.html | 2 +- courses/pyladies/pong/index.html | 4 +-- courses/pyladies/pyglet/index.html | 2 +- naucse/__init__.py | 2 +- naucse/routes.py | 38 ++++++++++++------------- naucse/templates.py | 4 +-- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/courses/mi-pyt/index.html b/courses/mi-pyt/index.html index 6cf7e0e0b4..160a1ba554 100644 --- a/courses/mi-pyt/index.html +++ b/courses/mi-pyt/index.html @@ -33,7 +33,7 @@

{% set icon_class = 'glyphicon-pencil' %} {% if 'link' in mat %} - {{ mat['name'] }} + {{ mat['name'] }} {% else %} {{ mat['name'] }} {% endif %} 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:
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/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..8d3fecc29e 100644 --- a/naucse/routes.py +++ b/naucse/routes.py @@ -50,22 +50,22 @@ def course_page(course): 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 +74,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) From 8a86e7a5474026d8012d6db697cdf9ff38f865ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20Krej=C4=8D=C3=AD?= Date: Fri, 13 Jan 2017 16:46:36 +0100 Subject: [PATCH 2/4] Remove redundant parts of plans. --- courses/mi-pyt/index.html | 13 +---------- courses/mi-pyt/plan.yml | 12 ----------- courses/pyladies/index.html | 13 +---------- courses/pyladies/plan.yml | 43 ++++++++++--------------------------- 4 files changed, 13 insertions(+), 68 deletions(-) diff --git a/courses/mi-pyt/index.html b/courses/mi-pyt/index.html index 160a1ba554..30970cda0b 100644 --- a/courses/mi-pyt/index.html +++ b/courses/mi-pyt/index.html @@ -15,20 +15,9 @@

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 %} - - {% 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' %} diff --git a/courses/pyladies/index.html b/courses/pyladies/index.html index 08f1633642..940f9ec3d6 100644 --- a/courses/pyladies/index.html +++ b/courses/pyladies/index.html @@ -20,7 +20,7 @@

{% for mat in lesson['materials'] %} {% endfor %}

diff --git a/naucse/routes.py b/naucse/routes.py index b08b39e178..f49cecc88c 100644 --- a/naucse/routes.py +++ b/naucse/routes.py @@ -50,8 +50,14 @@ def course_page(course): # Load dictionary of lessons names. for lesson in plan: for mat in lesson['materials']: - info_file = read_yaml("courses/" + course + "/" + mat['link'] + "/info.yml") - lesson_dict[mat['link']] = info_file['title'] + 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"), names=lesson_dict) @@ -100,4 +106,3 @@ def lesson_static(course, lesson, path): directory = os.path.join(app.root_path, 'courses') filename = os.path.join(course, lesson, 'static', path) return send_from_directory(directory, filename) -