From c0f4d5615a4fe9ba1ada7ec2606e4ddf4238374b Mon Sep 17 00:00:00 2001
From: Tom Wiesing <tkw01536@gmail.com>
Date: Fri, 23 Jun 2017 23:28:00 -0400
Subject: [PATCH] Get courses pages ready for deployment

---
 README.md                            |  2 +-
 _config.yml                          | 11 +++++++++--
 _includes/course.html                |  7 +++++++
 _includes/semester.html              | 15 +++++++++++++++
 _layouts/course.html                 | 10 ++++++++--
 {teaching => courses}/AIProj.md      | 12 ++++++++----
 {teaching => courses}/KRMT.md        |  8 +++++---
 {teaching => courses}/ai1.md         |  8 ++++++--
 {teaching => courses}/ai2.md         |  7 +++++--
 {teaching => courses/meta}/README.md | 10 ++++++----
 courses/meta/former.md               | 15 +++++++++++++++
 courses/meta/index.md                | 15 +++++++++++++++
 {teaching => courses}/wuv.md         |  9 +++++----
 13 files changed, 105 insertions(+), 24 deletions(-)
 create mode 100644 _includes/course.html
 create mode 100644 _includes/semester.html
 rename {teaching => courses}/AIProj.md (75%)
 rename {teaching => courses}/KRMT.md (91%)
 rename {teaching => courses}/ai1.md (92%)
 rename {teaching => courses}/ai2.md (94%)
 rename {teaching => courses/meta}/README.md (61%)
 create mode 100644 courses/meta/former.md
 create mode 100644 courses/meta/index.md
 rename {teaching => courses}/wuv.md (75%)

diff --git a/README.md b/README.md
index b2c00a3..2bb59f3 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ See the above links for details.
 * `public/*.md`: descriptions of the research areas
 * `students/*.md`: pages for students
 * `systems/*.md`: descriptions of the KWARC sytems 
-* `teaching/*.md`: KWARC courses (this may be obsoleted by univis)
+* `courses/*.md`: KWARC courses (this may be obsoleted by univis)
 
 ## Performance
 This jekyll page is tuned in order to build as fast as possible. 
diff --git a/_config.yml b/_config.yml
index 099a4a7..100f3fb 100644
--- a/_config.yml
+++ b/_config.yml
@@ -78,8 +78,15 @@ menu:
     - title: '4Students'
       url: '/students/'
       active: '/students/'
-    - title: 'Teaching'
-      folder: 'teaching'
+    
+    - title: 'Courses'
+      active: '/courses/'
+      items:
+          - title: 'Current Courses'
+            url: '/courses/'
+          - title: 'Former Courses'
+            url: '/courses/former/'
+    
     - title: 'Contact'
       url: '/contact/'
       
diff --git a/_includes/course.html b/_includes/course.html
new file mode 100644
index 0000000..86d8d43
--- /dev/null
+++ b/_includes/course.html
@@ -0,0 +1,7 @@
+{% comment %}
+    Renders a link to a single course. Expects 'item' as a parameter. 
+{% endcomment %}
+
+<li class="collection-item">
+    <a href="{{item.url}}" class="title">{{item.title}}</a>
+</li>
\ No newline at end of file
diff --git a/_includes/semester.html b/_includes/semester.html
new file mode 100644
index 0000000..490cb51
--- /dev/null
+++ b/_includes/semester.html
@@ -0,0 +1,15 @@
+{% comment %}
+    Renders the name of a single semester. Expects 'semester' as a parameter. 
+{% endcomment %}
+
+{% assign nosummer = semester | remove: "SS" %}
+{% assign semesteryear = nosummer | remove: "WS" %}
+
+<!-- string.contains doesn't work, neither does substring -->
+{% if nosummer == semester  %}
+    Winter
+{% else %}
+    Summer
+{% endif %}
+
+20{{semesteryear}}
\ No newline at end of file
diff --git a/_layouts/course.html b/_layouts/course.html
index 52bf807..d594acb 100644
--- a/_layouts/course.html
+++ b/_layouts/course.html
@@ -6,9 +6,15 @@ layout: default
   <div class="col s12 m5 left">
     <div class="card">
       <div class="card-content">
-        <span class="card-title">{{page.title}} ({{page.taught}})</span>
+        <span class="card-title">{{page.title}}</span>
+        
         {% assign person = page.instructor %}
-        Instructor: {% include people_chip.html %}
+        {% include people_chip.html %}
+        <hr />
+        
+        {% for semester in page.semesters %}
+            {% include semester.html %}<br />
+        {% endfor %}
       </div>
     </div>
   </div>
diff --git a/teaching/AIProj.md b/courses/AIProj.md
similarity index 75%
rename from teaching/AIProj.md
rename to courses/AIProj.md
index ddaf9fd..84345e6 100644
--- a/teaching/AIProj.md
+++ b/courses/AIProj.md
@@ -1,12 +1,16 @@
 ---
 layout: course
-instructor: mkohlhase
+
 title: Projekt zur Künstlichen Intelligenz
-menu_title: KI-Projekt
-taught: WS16/17, SS16
+instructor: mkohlhase
+
+semesters: 
+    - WS16/17
+    - SS16
+    - SS17
 ---
 
-The KWARC group (Wissensrepräsentation und Verarbeitung)conducts research in knowledge representation and reasoning techniques with a view towards applications in knowledge management. 
+The KWARC group (Wissensrepräsentation und Verarbeitung) conducts research in knowledge representation and reasoning techniques with a view towards applications in knowledge management. 
 We extend techniques from formal methods so that they can be used in settings where formalization is either infeasible or too costly. 
 We concentrate on developing techniques for marking up the structural semantics in technical documents. 
 This level of markup allows for offering interesting knowledge management services without forcing theauthor to formalize the document contents. 
diff --git a/teaching/KRMT.md b/courses/KRMT.md
similarity index 91%
rename from teaching/KRMT.md
rename to courses/KRMT.md
index e4502ee..2c38dcb 100644
--- a/teaching/KRMT.md
+++ b/courses/KRMT.md
@@ -1,9 +1,11 @@
 ---
 layout: course
-instructor: mkohlhase
+
 title: Vorlesung *Logik-Basierte Wissensrepräsentation für Mathematisch/Technisches Wissen*
-menu_title: Vorlesung KRMT
-taught: SS16/17
+instructor: mkohlhase
+
+semesters:
+    - SS16/17
 ---
 
 Dieser Kurs behandelt Grundlagen der Mathematik, Modulare Formalisierung in
diff --git a/teaching/ai1.md b/courses/ai1.md
similarity index 92%
rename from teaching/ai1.md
rename to courses/ai1.md
index e577c3f..cfaa404 100644
--- a/teaching/ai1.md
+++ b/courses/ai1.md
@@ -1,9 +1,13 @@
 ---
 layout: course
-instructor: mkohlhase
+
 title: Künstliche Intelligenz I
-taught: WS16
+instructor: mkohlhase
+
+semesters:
+    - WS16/17
 ---
+
 Diese Vorlesung beschäftigt sich mit den Grundlagen der Künstlichen Intelligenz (KI),
 insbesondere
 * Agentenmodelle als  Grundlagen der KI
diff --git a/teaching/ai2.md b/courses/ai2.md
similarity index 94%
rename from teaching/ai2.md
rename to courses/ai2.md
index fa32fc6..9590900 100644
--- a/teaching/ai2.md
+++ b/courses/ai2.md
@@ -1,8 +1,11 @@
 ---
 layout: course
-instructor: mkohlhase
+
 title: Künstliche Intelligenz II
-taught: SS16/17
+instructor: mkohlhase
+
+semesters:
+    - SS17
 ---
 
 Dieser Kurs beschäftigt sich mit den Grundlagen der Künstlichen Intelligenz (KI), insbesondere mit Techniken des Schliessens unter Unsicherheit, des maschinellen Lernens und des Sprachverstehens.
diff --git a/teaching/README.md b/courses/meta/README.md
similarity index 61%
rename from teaching/README.md
rename to courses/meta/README.md
index cd12abe..daf67be 100644
--- a/teaching/README.md
+++ b/courses/meta/README.md
@@ -7,8 +7,10 @@ examples.We keep the pages in the language the course will be in.
 Each file  needs some specific parameters:
 
  * **layout** use *course* 
+
  * **title** the title of the course/seminar
- * **subtitle** (optionnal) a subtitle. It will be adjuncted to your title in the post
- link and just under the title in the post page
- * **instructor** instructors
- * **menu_title** the title in the menu
+ * **instructor** instructor of the course
+
+ * **semesters** semesters in which the course was taught
+ 
+A semester is automatically regarded as active if the current semester matches one of the one in which the course was offered. 
\ No newline at end of file
diff --git a/courses/meta/former.md b/courses/meta/former.md
new file mode 100644
index 0000000..00e580a
--- /dev/null
+++ b/courses/meta/former.md
@@ -0,0 +1,15 @@
+---
+layout: default
+title: Former Courses
+permalink: /courses/former/
+---
+
+{% assign courses = site.pages | where: "layout", "course" | sort: "title" %}
+
+<ul class="collection">
+    {% for item in courses %}
+        {% unless item.semesters contains site.semester %}
+            {% include course.html %}
+        {% endunless %}
+    {% endfor %}
+</ul>
\ No newline at end of file
diff --git a/courses/meta/index.md b/courses/meta/index.md
new file mode 100644
index 0000000..8ba40bd
--- /dev/null
+++ b/courses/meta/index.md
@@ -0,0 +1,15 @@
+---
+layout: default
+title: Courses
+permalink: /courses/
+---
+
+{% assign courses = site.pages | where: "layout", "course" | sort: "title" %}
+
+<ul class="collection">
+    {% for item in courses %}
+        {% if item.semesters contains site.semester %}
+            {% include course.html %}
+        {% endif %}
+    {% endfor %}
+</ul>
diff --git a/teaching/wuv.md b/courses/wuv.md
similarity index 75%
rename from teaching/wuv.md
rename to courses/wuv.md
index 4d3dce0..fa60f21 100644
--- a/teaching/wuv.md
+++ b/courses/wuv.md
@@ -1,10 +1,11 @@
 ---
 layout: course
-instructor: mkohlhase
+
 title: Seminar Wissensrepräsentation und -verarbeitung
-menu_title: Seminar WuV
+instructor: mkohlhase
+
+semesters: []
 ---
 
 This seminar covers topics from knowledge representation and knowledge processing, mostly
-with a focus on mathematical knowledge.
-
+with a focus on mathematical knowledge.
\ No newline at end of file
-- 
GitLab