Merge branch 'master' into edition-3

This commit is contained in:
Philipp Oppermann
2021-01-03 14:48:32 +01:00
28 changed files with 900 additions and 87 deletions

View File

@@ -1,6 +1,6 @@
{% extends "edition-2/base.html" %}
{% import "macros.html" as macros %}
{% import "snippets.html" as snippets %}
{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}
@@ -17,6 +17,6 @@
<hr>
<section>
<h2>Comments</h2>
{{ macros::utterances() }}
{{ snippets::utterances() }}
</section>
{% endblock after_main %}

View File

@@ -1,6 +1,7 @@
{% extends "edition-2/base.html" %}
{% import "macros.html" as macros %}
{% import "edition-2/macros.html" as macros %}
{% import "snippets.html" as snippets %}
{% block title %}{{ config.title }}{% endblock title %}
@@ -8,20 +9,10 @@
{% set posts_section = get_section(path = "edition-2/posts/_index.md") %}
{% set posts = posts_section.pages %}
<h1 style="visibility: hidden; height: 0px; margin: 0px; padding: 0px;">Writing an OS in Rust</h1>
<div class="front-page-introduction">
<p>
This blog series creates a small operating system in the
<a href="https://www.rust-lang.org/">Rust programming language</a>. Each post is a small tutorial and includes all
needed code, so you can follow along if you like. The source code is also available in the corresponding
<a href="https://github.com/phil-opp/blog_os">Github repository</a>.
</p>
<p>Latest post:
{% set latest_post = posts|last %}
<strong><a href="{{ latest_post.path | safe }}">{{ latest_post.title }}</a></strong>
</p>
</div>
{{ section.content
| replace(from="<!-- latest-post -->", to=macros::latest_post(posts=posts))
| safe
}}
<div>
{%- set chapter = "none" -%}
@@ -71,7 +62,7 @@
<div class="">
<h2>Support Me</h2>
{% include "support.html" %}
{{ snippets::support() }}
</div>
{% endblock main %}

View File

@@ -0,0 +1,81 @@
{% macro latest_post(posts) %}
{% set post = posts|last %}
<strong><a href="{{ post.path | safe }}">{{ post.title }}</a></strong>
{% endmacro latest_post %}
{% macro post_link(page) %}
{% set translations = page.translations | filter(attribute="lang", value=lang) -%}
{%- if translations -%}
{%- set post = get_page(path = translations.0.path) -%}
{%- else -%}
{%- set post = page -%}
{%- set not_translated = true -%}
{%- endif -%}
<div{% if post.extra.rtl %} class="right-to-left"{% endif %}>
<h2 class="post-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h2>
<div class="post-summary">
{{ post.summary | safe }}
<a class="read-more" href="{{ post.path | safe }}"><em>read&nbsp;more&nbsp;»</em></a>
{%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation">
(This post is not translated yet.)
</aside>
{%- endif -%}
</div>
</div>
{% endmacro post_link %}
{% macro post_link_edition_3(page) %}
<div>
{% set translations = page.translations | filter(attribute="lang", value=lang) -%}
{%- if translations -%}
{%- set post = get_page(path = translations.0.path) -%}
{%- else -%}
{%- set post = page -%}
{%- set not_translated = true -%}
{%- endif -%}
<h3 class="post-list-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h3>
<span class="post-list-icon">
{%- if post.extra.icon -%}{{post.extra.icon | safe}}{%- endif -%}
</span>
<div class="post-summary">
{{ post.summary | safe }}
<a class="read-more" href="{{ post.path | safe }}"><em>read&nbsp;more&nbsp;»</em></a>
{%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation">
(This post is not translated yet.)
</aside>
{%- endif -%}
</div>
</div>
{% endmacro post_link %}
{% macro utterances_edition_3() %}
<script src="https://utteranc.es/client.js"
data-repo="phil-opp/blog_os"
data-issue-term="url"
data-label="comments"
crossorigin="anonymous"
theme="preferred-color-scheme"
async>
</script>
{% endmacro utterances_edition_3 %}
{% macro toc(toc) %}
<details id = "toc-inline">
<summary><b>Table of Contents</b></summary>
<ul>
{% for h2 in toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
{% if h2.children %}<ul>
{% for h3 in h2.children %}<li>
<a href="#{{h3.id | safe}}">{{ h3.title | safe }}</a>
</li>{% endfor %}
</ul>{% endif %}
</li>{% endfor %}
<li class="toc-comments-link"><a href="#comments">Comments</a></li>
</ul>
</details>
{% endmacro toc %}

View File

@@ -1,6 +1,7 @@
{% extends "edition-2/base.html" %}
{% import "macros.html" as macros %}
{% import "edition-2/macros.html" as macros %}
{% import "snippets.html" as snippets %}
{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}
{% block header %}
@@ -75,7 +76,7 @@
<div class="post-footer-support">
<h2>Support Me</h2>
{% include "support.html" %}
{{ snippets::support() }}
</div>
<hr>
@@ -98,7 +99,7 @@
</p>
{% endif %}
{{ macros::utterances() }}
{{ snippets::utterances() }}
</section>
<aside class="page-aside-right">

View File

@@ -0,0 +1,19 @@
{% extends "base.html" %}
{% import "edition-2/macros.html" as macros %}
{% block title %}{{ section.title }} | {{ config.title }}{% endblock title %}
{% block main %}
<h1>{{ section.title }}</h1>
{% block introduction %}{% endblock introduction %}
<div class="posts neutral">
{% for page in section.pages %}
{{ macros::post_link(page=page) }}
{% endfor %}
</div>
{% endblock main %}