Skip to main content

Module tile_structural

Module tile_structural 

Source
Expand description

The structural front end and the host boundary of Polytile (SRD 114 §3, §5.6).

A host may hold a template as text, as JSON text, or as a JSON value it has already parsed. All three arrive here and leave as a TileDef, the same statement the tile keyword produces, so the compiler has one tile to compile. The structural form is turned into template text first: strings become value holes, string holes, or statics by the rules of §3.1, and directive arrays and objects become @for and @if blocks by the rules of §3.2. The textual parser then yields the pieces, which is what makes the two forms equivalent by construction.

Constants§

ENCODINGS
The encodings a tile may declare.

Functions§

template_text_from_value
Turn a structural template into template text under options. The text is what an author would have written in a tile ... : json block for the same document.
tile_from_json_text
A tile from a structural template in JSON text (§3). The encoding is json.
tile_from_json_value
A tile from a structural template a host has already parsed (§3). The encoding is json.
tile_from_text
A tile from template text a host holds: the body of a tile statement without the statement. text may be multi-line; it is taken exactly, as a heredoc body is.