{% macro source_line(values) %}
Sources: {% for item in citations(values) %}{% if item.source_url|default('') %}{{ item.source_label }}: {{ item.title }}{% else %}{{ item.source_label }}: {{ item.title }}{% endif %}{% if not loop.last %}; {% endif %}{% endfor %}
{% endmacro %} {% macro table_rows(article, field, columns) %}{% if article[field]|default([]) %}{% for label, key in columns %}{% endfor %}{% for identity in article[field] %}{% set row = source_item(identity) %}{% for label, key in columns %}{% endfor %}{% endfor %}
{{ label }}
{% if key == 'parent_id' %}{{ parent_label(row[key]|default('')) }}{% else %}{{ row[key]|default('Undated' if key == 'due_date' else '') }}{% if field == 'task_ids' and key == 'title' and row.notes|default('') %}
{{ row.notes }}{% endif %}{% endif %}
{% endif %}{% endmacro %} {% macro article_block(article) %}
{% if article.kicker|default('') %}
{{ article.kicker }}
{% endif %}

{{ article.headline }}

{% for paragraph in article.paragraphs %}

{{ paragraph }}

{% endfor %} {{ table_rows(article, 'grade_ids', [('Course','course'),('Mark','mark'),('Percent','percent'),('Term','term_id')]) }} {{ table_rows(article, 'assignment_ids', [('Assignment','title'),('Due','due_date'),('Status','state'),('Term','term_id')]) }} {{ table_rows(article, 'task_ids', [('Open task or subtask','title'),('Due','due_date'),('Parent','parent_id')]) }} {% if article.table|default(none) %}{% for h in article.table.headers %}{% endfor %}{% for row in article.table.rows %}{% for cell in row %}{% endfor %}{% endfor %}
{{ h }}
{{ cell }}
{% endif %} {% if article.steps|default([]) %}
    {% for step in article.steps %}
  1. {{ step }}
  2. {% endfor %}
{% endif %} {% if article.discussion_question|default('') %}

Discuss: {{ article.discussion_question }}
Decide together: {{ article.decision_needed }}

{% endif %} {{ source_line(article.source_ids) }}
{% endmacro %} {% macro puzzle_block(name) %}{% set puzzle = e.puzzles[name] %}{% set checked = qa.games[name] %}
{% if name == 'crossword' %}

The Mini / 5 x 5

{% for row in puzzle.grid %}{% set r=loop.index0 %}{% for cell in row %}{% set key = r|string ~ ',' ~ loop.index0|string %}{% endfor %}{% endfor %}
{% if key in checked.labels %}{{ checked.labels[key] }}{% endif %}
{% for direction in ['across','down'] %}{{ direction|upper }}{% for clue in puzzle.clues if clue.direction == direction %}

{{ clue.number }}. {{ clue.clue }}

{% endfor %}{% endfor %}
{% for clue in puzzle.clues %}{{ clue.number }}{{ clue.direction[0]|upper }} {{ clue.answer }}{% if not loop.last %} / {% endif %}{% endfor %}
{% elif name == 'jumble' %}

The Jumble

{{ puzzle.intro }}

{% for word in puzzle.words %}
{{ word.scrambled }}
{% for letter in word.answer %}{% endfor %}
{% endfor %}

Bonus: {{ puzzle.bonus_clue }}

{% for char in puzzle.bonus if char != ' ' %}{% endfor %}
{% for word in puzzle.words %}{{ word.answer }} / {% endfor %}{{ puzzle.bonus }}
{% elif name == 'sudoku' %}

Sudoku

{{ puzzle.instructions }}

{% for row in checked.grid %}{% for value in row %}{% endfor %}{% endfor %}
{{ value if value != '0' else '' }}

{{ checked.givens }} givens. One verified solution.

{% for row in checked.solution %}
{{ row }}
{% endfor %}
{% elif name == 'chess' %}

Chess / Mate in One

{{ puzzle.instructions }}

{% for rank in [8,7,6,5,4,3,2,1] %}{{ rank }}{% endfor %}
{% for row in checked.rows %}{% set r=loop.index0 %}{% for piece in row %}{% endfor %}{% endfor %}
{{ piece }}
{% for file in 'abcdefgh' %}{{ file }}{% endfor %}

{{ checked.side }} to move. Exactly one legal mating move.

{{ checked.san }} / {{ puzzle.explanation }}
{% endif %}
{% endmacro %} {% for page in e.pages %}{% set section=p.sections[loop.index0] %}
{{ e.date }} / {{ e.timezone }}{{ section.title }}{% if section.part|default(0) %} / {{ section.part }} of 2{% endif %}
{% if loop.first %}
{{ p.motto|default('') }}
{{ e.title }}
{% endif %} {% if e.mode == 'demo' %}
FICTIONAL SAMPLE / invented household and source data
{% endif %}

{{ section.title }}

{{ page.deck }}

{% if page.start_date|default('') %}
{{ page.start_date }} through {{ page.end_date }}, inclusive
{% endif %}
{% if page.image|default(none) %}{{ page.image.alt }}{% endif %} {% if page.comic|default(none) %}
{% for caption in page.comic.captions %}

{{ caption }}

{% endfor %}
{% endif %} {% if page.drawing_lesson|default(none) %}
{% for subject in page.drawing_lesson.subjects %}

{{ subject.breed }} {{ subject.species }}

{{ subject.pose }}

    {% for step in subject.steps %}
  1. {{ step }}
  2. {% endfor %}
{% endfor %}
{% endif %} {% if page.articles %}
{% for article in page.articles %}{{ article_block(article) }}{% endfor %}
{% endif %} {% if page.front_week|default(none) %}

Sunday to Sunday / {{ page.front_week.start_date }} through {{ page.front_week.end_date }}

{% for item in page.front_week['items'] %}{% endfor %}
{{ item.event_date }}{{ item.title }} {{ item.body|default('') }}{{ source_line(item.source_ids) }}
{% endif %} {% if section.games|default([]) %}
{% for game in section.games %}{{ puzzle_block(game) }}{% endfor %}
{% endif %} {% for note in page.coverage_notes|default([]) %}{% endfor %} {% if not qa.coverage.complete and loop.first %}{% endif %}
{% endfor %}