Appearance
Page Repeats
Similar to content, the document structure can also repeat over data items, e.g.
xml
<document>
<repeat data="data.people" item="person">
<greeting-page>
<h1>Hello, {{ person.name }}!</h1>
</greeting-page>
</repeat>
</document>Repeating over Groups
Beyond repeating over data, content flow groups can be repeated over with the syntax <repeat group="...">...</repeat>, e.g.
xml
<flows>
<group name="sections">
<section-one type="markdown">
<data>
<title>Section One</title>
</data>
# This is a heading
...
</section-one>
<section-two type="markdown">
<data>
<title>Section Two</title>
</data>
...
</section-two>
</group>
</flows>
<document width="595pt" height="842pt">
<repeat group="sections" item="section">
<section-coverpage v-align="center" text-align="center">
<h1>{{ section.data.title }}</h1>
</section-coverpage>
<section-body repeat="true">
<frame top="12pt" left="12pt" font-size="14pt">{{ section.data.title }}</frame>
<frame margin="72pt">
<flow name="section" />
</frame>
</section-body>
</repeat>
</document>This can be especially powerful in the case of nested group structures (i.e. groups within groups).
Repeating over Content
Another special case of page repeats involves repeating over a given set of flows. Suppose you had two page definitions, even-page and odd-page and you wanted to alternate between them until the body content flow were empty? It turns out this is fairly simple:
xml
<document>
<repeat flow="body">
<left-page />
<right-page />
</repeat>
</document>You can even repeat over multiple content flows (i.e. repeat until all are empty), like so:
xml
<document>
<repeat flow="body; items">
<left-page />
<right-page />
</repeat>
</document>In fact, the statement <page repeat="true" flow="..." /> that we've seen a few times up until now is just a simplified way of expressing
xml
<repeat flow="...">
<page flow="..." />
</repeat>