{#- The Listen page's text, one chapter at a time: listen.html draws every chapter with it, and a book that is still growing (#724) gets each new chapter drawn by the same macro, through the chapter route, so a chapter added while the page is open is the same as one drawn with the page. Import it "with context" (it needs `t` and `document`). -#} {% from "_icons.html" import icon %} {#- A piece of a block: a sentence the voice reads (`.s`) or text between sentences. Its parts show what the audiobook's own edits did (#392, D-665 conflict 2, D-704b): text left out is struck in pencil, text read differently is underlined with its reading. -#} {% macro parts(piece) -%} {%- if piece.parts -%} {%- for part in piece.parts -%} {%- if part.mark == 'cut' -%}{{ part.text }} {{ t('listen.cut_hidden') }} {%- elif part.mark == 'said' -%}{{ part.text }} {{ t('listen.said_as_hidden', said=part.said) }} {%- else -%}{{ part.text }}{%- endif -%} {%- endfor -%} {%- else -%}{{ piece.text }}{%- endif -%} {%- endmacro %} {% macro pieces(block) -%} {%- for piece in block.pieces -%} {%- if piece.element -%}{{ parts(piece) }} {%- else -%}{{ parts(piece) }}{%- endif -%} {%- endfor -%} {%- endmacro %} {% macro show(block) -%} {% if block.page %}

{{ t('listen.page', page=block.page) }}

{% endif %} {% if block.notice %}

{{ icon('skip') }}{{ t('listen.notice') }} {{ block.notice }}

{% for figure in block.figures %}{{ figure.alt }}{% endfor %} {% if block.printed %}
{{ t('listen.found') }}

{{ block.printed }}

{% endif %} {% if block.code %}
{{ block.code }}
{% endif %}
{% elif block.heading %} {% if not block.read %}{{ t('listen.not_read') }} {% endif %}{{ pieces(block) }} {% else %}

{% if not block.read %}{{ t('listen.not_read') }} {% endif %}{{ pieces(block) }}

{% endif %} {%- endmacro %} {% macro sheet_chapter(chapter, n) -%}
{% if chapter.title_block %} {{ show(chapter.title_block) }} {% else %}

{{ chapter.title }}

{% endif %} {% for block in chapter.blocks %} {{ show(block) }} {% endfor %}
{%- endmacro %}