Browse Source

i dunno, touch all the html stuff

main
xenua 1 year ago
parent
commit
b7573a9163
  1. 20
      templates/index.html
  2. 44
      templates/macros.html
  3. 7
      templates/page.html
  4. 13
      templates/section.html
  5. 8
      templates/shortcodes/img.html

20
templates/index.html

@ -3,19 +3,13 @@ @@ -3,19 +3,13 @@
{% import "macros.html" as macros %}
{% block content %}
{% for page in section.pages | reverse %}
<h1><a href="{{ page.permalink }}" class="stealth">{{ page.title }}</a></h1>
{% if page.date %}
<span>{{ page.date | date(format="%Y-%m-%d") }}{% if page.extra.author %}, by {{ page.extra.author }}{% endif %}</span>
{% endif %}
{% if page.summary %}
{% if config.extra.summary_max_length %}
{% set sum = page.summary | safe | truncate(length=config.extra.summary_max_length) %}
{% else %}
{% set sum = page.summary | safe %}
{% endif %}
<p>{{ sum | safe }}</p>
{% endif %}
{% if section.extra.reverse_order | default(value=true) %}
{% set pages = section.pages | reverse %}
{% else %}
{% set pages = section.pages %}
{% endif %}
{% for page in pages %}
{{ macros::render_article_summary(page=page) }}
{% if not loop.last %}<hr>{% endif %}
{% endfor %}
{% endblock %}

44
templates/macros.html

@ -16,6 +16,50 @@ @@ -16,6 +16,50 @@
{% endif %}
{% endmacro typeof %}
{% macro render_article_summary(page) %}
<h1><a href="{{ page.permalink }}" class="stealth">{{ page.title }}</a></h1>
{% set d = page.date is defined %}
{% set a = page.extra.author is defined %}
{% set r = page.reading_time is defined %}
{% if d or a or r %}
<span class="sidebyside">
<span>
{% if d %}<time>{{ page.date }}</time>{% if a %}, {% endif %}{% endif %}{% if a %}by {{ page.extra.author }}{% endif %}
</span>
<span>{% if page.reading_time %}{{ page.reading_time }} minute read{% endif %}</span>
</span>
{% endif %}
{% if page.summary %}
{% if config.extra.summary_max_length %}
{{ page.summary | safe | truncate(length=config.extra.summary_max_length) }}
{% else %}
{{ page.summary | safe }}
{% endif %}
{% endif %}
{% endmacro render_article_summary %}
{% macro toc(page) %}
<ul class="toc">
<li>
<a class="stealth" href="{{ page.permalink | safe }}#page-title">{{ page.title }}</a>
</li>
{% for h1 in page.toc %}
<li>
<a class="stealth" href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
<ul>
{% for h2 in h1.children %}
<li>
<a class="stealth" href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endmacro toc %}
{% macro debug(thing, label="", recurse=0) %}
{% set type = self::typeof(thing=thing) | trim %}

7
templates/page.html

@ -31,11 +31,16 @@ @@ -31,11 +31,16 @@
{% endif %}
<span id="page-read-time">Read time: <time>{{ page.reading_time }}</time> minutes</span>
{% if page.extra.external_reading %}
<details open>
<summary id="page-toc">Table of Contents:</summary>
{{ macros::toc(page=page) }}
</details>
<span id="page-external-reading">
External reading:
<ul>
{% for extlink in page.extra.external_reading %}
<li><a href="{{ extlink.url }}">{{ extlink.text }}</a></li>
<li><a target="_blank" href="{{ extlink.url }}">{{ extlink.text }}</a></li>
{% endfor %}
</ul>
</span>

13
templates/section.html

@ -4,18 +4,7 @@ @@ -4,18 +4,7 @@
{% block content %}
{% for page in section.pages | reverse %}
<h1><a href="{{ page.permalink }}" class="stealth">{{ page.title }}</a></h1>
{% if page.date %}
<span>{{ page.date | date(format="%Y-%m-%d") }}</span>
{% endif %}
{% if page.summary %}
{% if config.extra.summary_max_length %}
{% set sum = page.summary | safe | truncate(length=config.extra.summary_max_length) %}
{% else %}
{% set sum = page.summary | safe %}
{% endif %}
<p>{{ sum | safe }}</p>
{% endif %}
{{ macros::render_article_summary(page=page) }}
{% if not loop.last %}<hr>{% endif %}
{% endfor %}
{% endblock %}

8
templates/shortcodes/img.html

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{# {{ img(url="", alt="", caption="", resize=false, allow_tall=false) }} #}
{% set article_width = 960 %}
{% set article_width = 1280 %}
{% if resize %}
{% set effective_image = resize_image(path=url, width=article_width, op="fit_width") %}
@ -8,13 +8,15 @@ @@ -8,13 +8,15 @@
{% set effective_image = get_image_metadata(path=url) %}
{% endif %}
{% set full_image_url = get_url(path=url) %}
{% set crop_height = config.extra.image_vertical_crop_height | default(value=768) %}
{% set cropped = effective_image.height > crop_height and not allow_tall %}
<figure>
<img
src="{% if resize %}{{ effective_image.url }}{% else %}/{{ url }}{% endif %}"
src="{% if resize %}{{ effective_image.url }}{% else %}{{ full_image_url }}{% endif %}"
alt="{{ alt }}"
title="{{ alt }}"
{%- if cropped %}height="{{ crop_height }}" width="{{article_width}}"{% endif %}
@ -22,7 +24,7 @@ @@ -22,7 +24,7 @@
{% if caption or resize or cropped %}
<div>
{% if caption %}<figcaption>{{ caption | safe }}</figcaption>{% endif %}
{% if resize or cropped %}<a href="/{{ url }}" target="_blank"> full size</a>{% endif %}
{% if resize or cropped %}<a href="{{ full_image_url }}" target="_blank"> full size</a>{% endif %}
</div>
{% endif %}
</figure>
Loading…
Cancel
Save