summaryrefslogtreecommitdiffstats
path: root/templates_html/macros.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates_html/macros.html')
-rw-r--r--templates_html/macros.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/templates_html/macros.html b/templates_html/macros.html
new file mode 100644
index 0000000..3922659
--- /dev/null
+++ b/templates_html/macros.html
@@ -0,0 +1,45 @@
+{% macro toc(page) %}
+<nav class="toc">
+ <ul>
+ {% for h in page.toc %}
+ <li><a href="{{ h.permalink }}">{{ h.title }}</a></li>
+ {% if h.children %}
+ <ul>
+ {% for c in h.children %}
+ <li><a href="{{ c.permalink }}">{{ c.title }}</a></li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% endfor %}
+ </ul>
+</nav>
+{% endmacro %}
+
+{% macro linklog(page) %}
+{% set lh_data = load_data(path="linklog.json") %}
+<ul class="archive-list">
+{% for lh_post in lh_data.posts %}
+ <li class="archive-entry">
+ <a href="{{ lh_post.href }}">{{ lh_post.description }}</a>
+ <small>({{ lh_post.time | date(format='%Y-%m-%d') }})</small>
+ </li>
+{% endfor %}
+</ul>
+{% endmacro %}
+
+{% macro page_h1(page) %}
+<h1>
+ {{ page.title }}<br />
+ {% if page.date %}
+ <small>({{ page.date }})</small>
+ {% endif %}
+ {% if page.extra.kind %}
+ <small>[{{ page.extra.kind }}]</small>
+ {% endif %}
+</h1>
+{% endmacro %}
+
+{% macro page_content(page) %}
+{{ self::page_h1(page=page) }}
+{{ page.content | replace(from="<!-- toc -->", to=macros::toc(page=page)) | safe }}
+{% endmacro %}