Cite.Source (Cite v0.1.0)

Copy Markdown View Source

The document as the caller's list of passages. Built by Cite.source/2, which documents as and show. Only the meta keys show names reach the model; the rest of meta stays with the caller.

Shown meta goes on the wire, so its values must be JSON: nil, booleans, atoms, numbers, UTF-8 binaries, and lists and plain maps of these, with atom or binary keys.

Summary

Functions

Builds a source from units, each a text or %{text: text} with optional :id and :meta. Text is kept byte for byte. Missing ids default to P000, P001, and so on. Raises ArgumentError on a unit, id, text, shown meta value, or option it cannot use.

Types

t()

@type t() :: %Cite.Source{
  as: String.t(),
  passages: [Cite.Passage.t()],
  show: [atom() | String.t()]
}

Functions

new(units, opts \\ [])

@spec new([String.t() | map()], keyword()) :: t()

Builds a source from units, each a text or %{text: text} with optional :id and :meta. Text is kept byte for byte. Missing ids default to P000, P001, and so on. Raises ArgumentError on a unit, id, text, shown meta value, or option it cannot use.