diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-05 18:08:25 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-05 18:08:25 -0700 |
commit | 865bf40e1a761f09383294b1f3d5d70b24bc4a4b (patch) | |
tree | f94da536a3e79a65db36e0e58bc338dac9a03a1a /theme | |
parent | 562ee2b77fb3c1037d1f08abf85891c6dc6666db (diff) | |
download | gitbook-865bf40e1a761f09383294b1f3d5d70b24bc4a4b.zip gitbook-865bf40e1a761f09383294b1f3d5d70b24bc4a4b.tar.gz gitbook-865bf40e1a761f09383294b1f3d5d70b24bc4a4b.tar.bz2 |
Add exercise solutions at the end of the pdf book
Diffstat (limited to 'theme')
-rw-r--r-- | theme/templates/page.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/theme/templates/page.html b/theme/templates/page.html index a479884..6b8c6ca 100644 --- a/theme/templates/page.html +++ b/theme/templates/page.html @@ -87,6 +87,33 @@ </section> {% endif %} {% endfor %} + + + {# Exercise solutions #} + {% if exercise > 0 %} + {% set exercise = 0 %} + <section> + <article class="new-chapter"> + <h1>Exercise Solutions</h1> + </article> + <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 %} + {% endfor %} + {% endfor %} + </article> + </section> + {% endif %} {% endblock %} {% block javascript %}{% endblock %}
\ No newline at end of file |