mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 08:05:19 +00:00
143 lines
6.0 KiB
HTML
143 lines
6.0 KiB
HTML
{% extends "layout.html" %}
|
|
|
|
{% block title %}{{ title }}{% endblock %}
|
|
|
|
{% block style %}
|
|
{% parent %}
|
|
<link rel="stylesheet" href="{{ staticBase }}/print.css">
|
|
{% endblock %}
|
|
|
|
{% set exercise = 1 %}
|
|
{% block content %}
|
|
{# Cover #}
|
|
<section id="cover">
|
|
<h1>{{ title }}</h1>
|
|
{% if githubId %}
|
|
<h2>By <a href="{{ githubHost }}{{ githubAuthor }}">@{{ githubAuthor }}</a></h2>
|
|
{% endif %}
|
|
</section>
|
|
|
|
{# Summary #}
|
|
<section id="summary">
|
|
<h1>Summary</h1>
|
|
|
|
<ul class="summary">
|
|
<li>
|
|
<a href="#README.md">Introduction</a>
|
|
</li>
|
|
{% for item in summary.chapters %}
|
|
<li>
|
|
<a href="#{{ item.path }}">{{ item.level }}) {{ item.title }}</a>
|
|
{% if item.articles.length > 0 %}
|
|
<ul>
|
|
{% for article in item.articles %}
|
|
<li>
|
|
<a href="#{{ article.path }}">{{ article.level }}) {{ article.title }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</section>
|
|
|
|
{# Pages content #}
|
|
<section>
|
|
<article id="README.md">
|
|
{% for section in pages["README.md"].content %}
|
|
{% if section.type == "normal" %}
|
|
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
|
{% 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>
|
|
{% elif section.type == "quiz" %}
|
|
<div class="quiz">
|
|
<div class="exercise-header">Exercise #{{ exercise }}</div>
|
|
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
|
{% autoescape false %}{{ section.quiz.base }}{% endautoescape %}
|
|
{% set exercise = exercise + 1 %}
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</article>
|
|
</section>
|
|
{% for item in summary.chapters %}
|
|
{% if item.articles.length > 0 %}
|
|
<section>
|
|
<article id="{{ item.path }}" class="new-chapter">
|
|
<h1>{{ item.title }}</h1>
|
|
</article>
|
|
|
|
{% for article in item.articles %}
|
|
{% if pages[article.path] %}
|
|
<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>
|
|
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
|
<pre><code>{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}</code></pre>
|
|
{% set exercise = exercise + 1 %}
|
|
</div>
|
|
{% elif section.type == "quiz" %}
|
|
<div class="quiz">
|
|
<div class="exercise-header">Exercise #{{ exercise }}</div>
|
|
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
|
{% autoescape false %}{{ section.quiz.base }}{% endautoescape %}
|
|
{% set exercise = exercise + 1 %}
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</article>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</section>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
|
|
{# Exercise solutions #}
|
|
{% if exercise > 1 %}
|
|
{% set exercise = 1 %}
|
|
<section>
|
|
<article class="new-chapter">
|
|
<h1>Exercise Solutions</h1>
|
|
</article>
|
|
<article>
|
|
{% for item in summary.chapters %}
|
|
{% for article in item.articles %}
|
|
{% 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>
|
|
{% elif section.type == "quiz" %}
|
|
<div class="quiz">
|
|
<div class="exercise-header">Exercise #{{ exercise }}</div>
|
|
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
|
{% autoescape false %}{{ section.quiz.solution }}{% endautoescape %}
|
|
{% set exercise = exercise + 1 %}
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</article>
|
|
</section>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block javascript %}{% endblock %}
|