# Layout

The notion of layout interests the structure and appearance of questionnaires.

## Structure

The structure of layout is about the components that may be selected to form questionnaires, and the containment and orderings relationships that may be defined between components.

Typically, there's a natural alignment between the structure of selections and the structure of layout, i.e. relevant subsets of selections are presented with different components.

> In the current system, the structure of questionnaires is comprised of:
>
> * a **front page**. This serves a number of purposes, and includes components for: the title of the questionnaire, a form for correspondent info, an optional table of contents, general filling instructions, the deadline for submissions, general contact info, etc.
> * one or more **data sections**. Sections include components for titles, descriptions, and one or more subsections, each with their own header and a table-based rendering of the corresponding selection of data from the target datasets.
> * one or more **metadata sections**. Metadata sections include components for titles and descriptions, and include a form for gathering metadata about the data of a corresponding section, as well as form for gathering metadata about the questionnaire as a whole.
>
> Front pages, data sections, and metadata sections are all published as `Excel` sheets.\
> In this context, additional structure can be provided with a number of extra sheets; the sheets are manually prepared and included in a **template file** stored with a conventional name alongside the main questionnaire configuration file. The possibilities here are limited: content is static and completely opaque to the system. Accordignly, templates are normally dedicated to instructions and other forms of free-form documentation.
>
> **note**: the order of pages, sections, and sheets is fixed and as described above. In particular, template sheets can only appear in tail position and sheets with datasections cannot be interleaved with sheets containing the corresponding metadata sections. Strict ordering does not reflect domain requirements; it descends from assumptions and constraints on the publication and re-ingestion processes.

Like the reference data of selections, many structural components of the layout include multi-lingual textual content (e.g. title, descriptions, headers, instructions, documentation, etc).

> In the current system, multi-lingual content is handled in one of two ways:
>
> * content included in templates, such as instructions and other forms of documentations, is expressed in a single language. Multiple languages are accommodated with multiple template files, with individual languages being represented by convention in the file names.
> * content included in front-pages, data sections, and metadata sections is externalised in a **property file** stored with a conventional name alongside the main configuration file. A conventional use of property names is used to accommodate multi-lingual versions of the same content.
>
> **note**: property files are used for aspects of component configuration other than internationalisation.

## Appearance

A subset of component configuration relates to the appearance of components on a target publication format., including the typography, colouring, spacing, visiblity, margins, etc.

> The appeareance of questionnaires in the current system is defined in the context of the publication format. Titles, descriptions, form fields, paragraphs, codes, and data are all styled as `Excel` allows for its cells.
>
> Until recently, the definition of styles was hardcoded in the generation process. Currently, style overrides can be specified with a **style file** stored with a conventional name alongside the main questionnaire configuration file.
