module

Hwaro::Content::FrontMatterSchema

Constants

KNOWN_KEYS = Processors::Markdown::KNOWN_FRONT_MATTER_KEYS
TOML_MULTILINE_DELIMITERS = {"\"" * 3, "'" * 3}

Instance methods

check(rule : Models::ContentSchemaConfig, file : String, source : String, extra : Hash(String, Models::ExtraValue), cascade : Hash(String, Models::ExtraValue), locate : Bool = true, taxonomies : Array(String) = [] of String) : Result

Check one regular page. source is the page's whole source text (front matter + body); extra the page's extra (with or without cascaded keys — cascade, the merged ancestor cascade, fills in whatever it lacks). A field name without the extra. prefix names a known front-matter field, or else the extra key the parser stores an unknown top-level key under. taxonomies are the configured taxonomy names, which strict accepts as top-level keys.

Lookups test presence (fetch), never truthiness: an explicit false is a value, so it meets required and keeps its default out.

Source
declared_keys(config : Models::Config) : Set(String)

Top-level front-matter keys the config declares beyond the built-in ones: taxonomy names and bare [[content.schema]] field names. The parser's typo warning skips them.

Source
raise_if_any!(violations : Array(Violation)) : Nil

Fail the build (HWARO_E_CONTENT) with every violation, sorted by file.

Source
rule_for(config : Models::Config, section : String) : Models::ContentSchemaConfig | Nil

The first schema (config order) whose sections match, like [permalinks]; nil when the page is not validated.

Source
taxonomy_names(config : Models::Config) : Array(String)

Every taxonomy name the site configures, any language.

Source

Nested types