From fb26b634ce2f332bcc3a8764009bdc65a2245f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Sun, 6 Apr 2014 01:59:53 -0700 Subject: [PATCH] Fix page format when chapters are not yet written --- theme/templates/page.html | 50 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/theme/templates/page.html b/theme/templates/page.html index 9793cc4a5..b23c81edd 100644 --- a/theme/templates/page.html +++ b/theme/templates/page.html @@ -65,20 +65,22 @@ {% for article in item.articles %} -
- {% for section in pages[article.path].content %} - {% if section.type == "normal" %} - {% autoescape false %}{{ section.content }}{% endautoescape %} - {% elif section.type == "exercise" %} -
-
Exercise #{{ exercise }}
+ {% if pages[article.path] %} +
+ {% for section in pages[article.path].content %} + {% if section.type == "normal" %} {% autoescape false %}{{ section.content }}{% endautoescape %} -
{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}
- {% set exercise = exercise + 1 %} -
- {% endif %} - {% endfor %} -
+ {% elif section.type == "exercise" %} +
+
Exercise #{{ exercise }}
+ {% autoescape false %}{{ section.content }}{% endautoescape %} +
{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}
+ {% set exercise = exercise + 1 %} +
+ {% endif %} + {% endfor %} + + {% endif %} {% endfor %} {% endif %} @@ -95,16 +97,18 @@
{% for item in summary.chapters %} {% for article in item.articles %} - {% for section in pages[article.path].content %} - {% if section.type == "exercise" %} -
-
Exercise #{{ exercise }}
- {% autoescape false %}{{ section.content }}{% endautoescape %} -
{% autoescape false %}{{ section.code.solution|code }}{% endautoescape %}
- {% set exercise = exercise + 1 %} -
- {% endif %} - {% endfor %} + {% if pages[article.path] %} + {% for section in pages[article.path].content %} + {% if section.type == "exercise" %} +
+
Exercise #{{ exercise }}
+ {% autoescape false %}{{ section.content }}{% endautoescape %} +
{% autoescape false %}{{ section.code.solution|code }}{% endautoescape %}
+ {% set exercise = exercise + 1 %} +
+ {% endif %} + {% endfor %} + {% endif %} {% endfor %} {% endfor %}