{#
TEASER LIST (#332) — further reading: a date, a linked title, a line of
summary, a thumbnail and tags per teaser, each teaser the same shape.
Each row of teasers is a layout table whose cells are `stack-column`s, so
two or three across stack on a phone with no change to the `@media` block;
an empty cell the gutter wide sits between two, and stacks to
nothing. A short last row is padded with empty cells to keep its columns
the others' width. The row table does not collapse its borders: the model is
inherited, and a stacked cell, a table on a phone, would drop the padding
that parts one teaser from the next. Alone in its column a thumbnail sits beside the copy, in a
column `teaser_thumb` wide so every teaser's copy starts at one edge;
across, it tops its column at the column's width. The width attribute is
Outlook's; the CSS cap is the print engine's (#201). The title is the link,
in the heading's colour so it reads on any ground. Tags are the tag row's
neutral badges.
Context:
subtitle — Optional italic standfirst
across — Teasers to a row: 1 on paper and on a slide
share — Each column's share of the cell, a percent
rows — Lists of dicts: title, url, date, summary, image {src, alt, width, url}, tags
#}
{% from "common/badge.html" import badge, badge_type with context %}
{% macro thumb(image) -%}
{%- endmacro %}
{% macro copy(teaser) -%}
{% if teaser.date %}
{{ teaser.date | escape_html }}
{% endif %}{{ teaser.title | escape_html }}
{% if teaser.summary %}{{ teaser.summary | escape_html }}
{% endif %} {% if teaser.tags %}{{ subtitle | escape_html }}
{% endif %} {% for row in rows %} {% set final_row = loop.last %}
{% if teaser.image and across == 1 %}
{{ thumb(teaser.image) }}
{% endif %}
{{ copy(teaser) }}
{% endif %}
|
{% if not loop.last or row | length < across %}
{% endif %} {% endfor %} {% for _ in range(across - row | length) %} | {% if not loop.last %} | {% endif %} {% endfor %} |