Reads content files from the filesystem into Brix structs.
All functions take a content_dir path as the root of the content tree.
Summary
Functions
Formats a DateTime as a compact ISO string like "20241001T080000Z".
Parses a compact ISO timestamp directory name like "20241001T080000Z" into a DateTime. Returns nil if the format doesn't match.
Reads all author YAML files from authors/ and returns a sorted list of Brix.Author structs.
Reads all collection YAML files from collections/ and returns a sorted list.
Reads all layout YAML files from layouts/ and returns a sorted list of Brix.Layout structs.
Reads all media YAML files from media/ and returns a sorted list of Brix.Media structs.
Reads all page directories from pages/ and returns a sorted list of Brix.Page structs.
Reads all section template YAML files from templates/sections/ and returns a sorted list.
Reads all sections from a directory. Supports .yml, standalone .md, and
mixed .field.md files (where a markdown file provides a single field value
that is merged into its companion .yml section). Returns sections sorted by position.
Reads all shared section YAML files from shared_sections/ and returns a sorted list.
Reads site.yml from the content directory and returns a Brix.Site struct.
Reads all tag YAML files from tags/ and returns a sorted list of Brix.Tag structs.
Resolves shared section references in a list of sections. Takes a map of shared section name => %SharedSection{}.
Functions
@spec format_compact_iso(DateTime.t()) :: String.t()
Formats a DateTime as a compact ISO string like "20241001T080000Z".
@spec parse_compact_iso(String.t() | nil) :: DateTime.t() | nil
Parses a compact ISO timestamp directory name like "20241001T080000Z" into a DateTime. Returns nil if the format doesn't match.
@spec read_authors(String.t()) :: [Brix.Author.t()]
Reads all author YAML files from authors/ and returns a sorted list of Brix.Author structs.
@spec read_collections(String.t()) :: [Brix.Collection.t()]
Reads all collection YAML files from collections/ and returns a sorted list.
@spec read_layouts(String.t()) :: [Brix.Layout.t()]
Reads all layout YAML files from layouts/ and returns a sorted list of Brix.Layout structs.
@spec read_media(String.t()) :: [Brix.Media.t()]
Reads all media YAML files from media/ and returns a sorted list of Brix.Media structs.
@spec read_pages(String.t()) :: [Brix.Page.t()]
Reads all page directories from pages/ and returns a sorted list of Brix.Page structs.
@spec read_section_templates(String.t()) :: [Brix.SectionTemplate.t()]
Reads all section template YAML files from templates/sections/ and returns a sorted list.
@spec read_sections(String.t()) :: [Brix.Section.t()]
Reads all sections from a directory. Supports .yml, standalone .md, and
mixed .field.md files (where a markdown file provides a single field value
that is merged into its companion .yml section). Returns sections sorted by position.
@spec read_site(String.t()) :: {:ok, Brix.Site.t()} | {:error, term()}
Reads site.yml from the content directory and returns a Brix.Site struct.
@spec read_tags(String.t()) :: [Brix.Tag.t()]
Reads all tag YAML files from tags/ and returns a sorted list of Brix.Tag structs.
@spec resolve_sections([Brix.Section.t()], %{ required(String.t()) => Brix.SharedSection.t() }) :: [ Brix.Section.t() ]
Resolves shared section references in a list of sections. Takes a map of shared section name => %SharedSection{}.