Display posts of chapter as list

This commit is contained in:
Philipp Oppermann
2020-12-28 19:48:47 +01:00
parent 7cc3d5e3b9
commit 5c3015acc3
2 changed files with 21 additions and 16 deletions

View File

@@ -555,6 +555,10 @@ main img {
margin-right: -0.5rem;
}
.posts ul {
padding-left: 2em;
}
.posts.neutral {
border: 2px solid #999;
}

View File

@@ -29,27 +29,28 @@
<p>In the following posts, we explain how to create an operating system for the <code>x86_64</code> architecture step for step. Starting from scratch, we create a bootable OS kernel, implement basic input/output support, show how to test and debug our kernel, explain virtual memory management, and add support for multitasking and userspace programs.</p>
-->
<div>
{%- set chapter = "none" -%}
{%- for post in posts -%}
{%- if post.extra["chapter"] -%}
{%- if post.extra["chapter"] != chapter -%}
{# Begin new chapter #}
{%- set_global chapter = post.extra["chapter"] -%}
</div>
{% set chapter_slug = chapter | slugify %}
<div class="posts {{chapter_slug}}">
{% set chapter_page = get_page(path = "edition-3/chapters/" ~ chapter_slug ~ ".md" ) %}
<h2>{{ chapter_page.title }}</h2>
{{ chapter_page.content | safe }}
{%- if post.extra["chapter"] != chapter -%}
{%- if chapter != "none" -%}
</ul></div>
{%- endif -%}
{# Begin new chapter #}
{%- set_global chapter = post.extra["chapter"] -%}
{% set chapter_slug = chapter | slugify %}
<div class="posts {{chapter_slug}}">
{% set chapter_page = get_page(path = "edition-3/chapters/" ~ chapter_slug ~ ".md" ) %}
<h2>{{ chapter_page.title }}</h2>
{{ chapter_page.content | safe }}
<ul>
{%- endif -%}
{{ macros::post_link_edition_3(page=post) }}
<li>{{ macros::post_link_edition_3(page=post) }}</li>
{%- endfor -%}
</div>
</ul></div>
<hr>