Skip to main content

Module data

Module data 

Source
Expand description

The metadata written as data: how a program that holds the author’s metadata as a map of data values (for example the root keys of a front matter) makes the document’s DocMeta from it, with DocMeta::from_data.

The form is the same for every program:

KeyIts value
TITLE_KEY (title)one text
AUTHOR_KEY (author)one author, or a list of authors
DATE_KEY (date)one text
any other keyany data, kept in DocMeta::other

An author (MetaAuthor) is a text, the author’s name, or a map:

KeyIts value
NAME_KEY (name)one text; required
AFFILIATION_KEY (affiliation)one text, or a list of texts
EMAIL_KEY (email)one text, a plain address
NOTE_KEY (note)one text, or a list of texts
any other keyany data, kept in MetaAuthor::other
author:
  - name: 'Ada Lovelace'
    affiliation: ['University of X', 'Institute of Y']
    email: 'ada@example.com'
    note: 'Corresponding author'
  - 'Grace Hopper'

Where a text is expected, a number or a truth value is read as the text it is written as (date: 2026 is the text 2026). A value of another shape, and an author’s map without name, are errors (MetaDataError). The texts are FLM, parsed when the document is processed, except the email address, which is not parsed. metadata_schema describes the same form as a JSON Schema.

Structs§

MetaDataError
A value of the metadata’s data that is not of the form the module documentation states: where it is, and what is wrong. It is displayed as its detail.
MetaPath
Where a value is in the metadata’s data: its key, then the steps from the key’s value down to the value (MetaStep). It is displayed as the key and the steps joined by .: author.1 for the second author of a list, author.0.affiliation for the affiliations of the first, and the key alone for the key’s own value.

Enums§

MetaStep
One step of a MetaPath into a value: an item of a list, or the value of a key of a map.

Constants§

AFFILIATION_KEY
The key of an author’s affiliations in an author’s map, affiliation: one text, or a list of texts.
AUTHOR_KEY
The key of the authors, author: one author, or a list of authors, each a text (the author’s name) or a map (see the module documentation).
DATE_KEY
The key of the date, date: one text, as the author writes the date.
EMAIL_KEY
The key of an author’s email address in an author’s map, email: one text, a plain address.
NAME_KEY
The key of an author’s name in an author’s map, name: one text, required.
NOTE_KEY
The key of the notes about an author in an author’s map, note: one text, or a list of texts.
TITLE_KEY
The key of the title, title: one text.

Functions§

metadata_schema
Returns the JSON Schema of the metadata written as data, in the form the module documentation states: a map in which TITLE_KEY and DATE_KEY hold texts, AUTHOR_KEY one author or a list of authors, and any other key any value. The schema refers to no definition of its own. A program uses it to describe the files in which authors write metadata, for example to an editor that checks them.