summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-04-06 01:59:53 -0700
committerSamy Pessé <samypesse@gmail.com>2014-04-06 01:59:53 -0700
commitfb26b634ce2f332bcc3a8764009bdc65a2245f35 (patch)
tree0bedd36490851d9836b9faed5e5204a35da661d5
parenta34dc458c9a78802c24497ef2ccf1e2d83ac0276 (diff)
downloadgitbook-fb26b634ce2f332bcc3a8764009bdc65a2245f35.zip
gitbook-fb26b634ce2f332bcc3a8764009bdc65a2245f35.tar.gz
gitbook-fb26b634ce2f332bcc3a8764009bdc65a2245f35.tar.bz2
Fix page format when chapters are not yet written
-rw-r--r--theme/templates/page.html50
1 files changed, 27 insertions, 23 deletions
diff --git a/theme/templates/page.html b/theme/templates/page.html
index 9793cc4..b23c81e 100644
--- a/theme/templates/page.html
+++ b/theme/templates/page.html
@@ -65,20 +65,22 @@
</article>
{% for article in item.articles %}
- <article id="{{ article.path }}">
- {% for section in pages[article.path].content %}
- {% if section.type == "normal" %}
- {% autoescape false %}{{ section.content }}{% endautoescape %}
- {% elif section.type == "exercise" %}
- <div class="exercise">
- <div class="exercise-header">Exercise #{{ exercise }}</div>
+ {% if pages[article.path] %}
+ <article id="{{ article.path }}">
+ {% for section in pages[article.path].content %}
+ {% if section.type == "normal" %}
{% autoescape false %}{{ section.content }}{% endautoescape %}
- <pre><code>{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}</code></pre>
- {% set exercise = exercise + 1 %}
- </div>
- {% endif %}
- {% endfor %}
- </article>
+ {% elif section.type == "exercise" %}
+ <div class="exercise">
+ <div class="exercise-header">Exercise #{{ exercise }}</div>
+ {% autoescape false %}{{ section.content }}{% endautoescape %}
+ <pre><code>{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}</code></pre>
+ {% set exercise = exercise + 1 %}
+ </div>
+ {% endif %}
+ {% endfor %}
+ </article>
+ {% endif %}
{% endfor %}
</section>
{% endif %}
@@ -95,16 +97,18 @@
<article>
{% for item in summary.chapters %}
{% for article in item.articles %}
- {% for section in pages[article.path].content %}
- {% if section.type == "exercise" %}
- <div class="exercise">
- <div class="exercise-header">Exercise #{{ exercise }}</div>
- {% autoescape false %}{{ section.content }}{% endautoescape %}
- <pre><code>{% autoescape false %}{{ section.code.solution|code }}{% endautoescape %}</code></pre>
- {% set exercise = exercise + 1 %}
- </div>
- {% endif %}
- {% endfor %}
+ {% if pages[article.path] %}
+ {% for section in pages[article.path].content %}
+ {% if section.type == "exercise" %}
+ <div class="exercise">
+ <div class="exercise-header">Exercise #{{ exercise }}</div>
+ {% autoescape false %}{{ section.content }}{% endautoescape %}
+ <pre><code>{% autoescape false %}{{ section.code.solution|code }}{% endautoescape %}</code></pre>
+ {% set exercise = exercise + 1 %}
+ </div>
+ {% endif %}
+ {% endfor %}
+ {% endif %}
{% endfor %}
{% endfor %}
</article>