Browse Source

i dunno, touch all the html stuff

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

16
templates/index.html

@ -3,19 +3,13 @@
{% import "macros.html" as macros %} {% import "macros.html" as macros %}
{% block content %} {% block content %}
{% for page in section.pages | reverse %} {% if section.extra.reverse_order | default(value=true) %}
<h1><a href="{{ page.permalink }}" class="stealth">{{ page.title }}</a></h1> {% set pages = section.pages | reverse %}
{% 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 %} {% else %}
{% set sum = page.summary | safe %} {% set pages = section.pages %}
{% endif %}
<p>{{ sum | safe }}</p>
{% endif %} {% endif %}
{% for page in pages %}
{{ macros::render_article_summary(page=page) }}
{% if not loop.last %}<hr>{% endif %} {% if not loop.last %}<hr>{% endif %}
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

44
templates/macros.html

@ -16,6 +16,50 @@
{% endif %} {% endif %}
{% endmacro typeof %} {% 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) %} {% macro debug(thing, label="", recurse=0) %}
{% set type = self::typeof(thing=thing) | trim %} {% set type = self::typeof(thing=thing) | trim %}

7
templates/page.html

@ -31,11 +31,16 @@
{% endif %} {% endif %}
<span id="page-read-time">Read time: <time>{{ page.reading_time }}</time> minutes</span> <span id="page-read-time">Read time: <time>{{ page.reading_time }}</time> minutes</span>
{% if page.extra.external_reading %} {% 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"> <span id="page-external-reading">
External reading: External reading:
<ul> <ul>
{% for extlink in page.extra.external_reading %} {% 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 %} {% endfor %}
</ul> </ul>
</span> </span>

13
templates/section.html

@ -4,18 +4,7 @@
{% block content %} {% block content %}
{% for page in section.pages | reverse %} {% for page in section.pages | reverse %}
<h1><a href="{{ page.permalink }}" class="stealth">{{ page.title }}</a></h1> {{ macros::render_article_summary(page=page) }}
{% 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 %}
{% if not loop.last %}<hr>{% endif %} {% if not loop.last %}<hr>{% endif %}
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

8
templates/shortcodes/img.html

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