Hwaro::Utils::FrontmatterWriter
Constants
YAML 1.1 words that reparse as booleans/null when left bare (Jekyll
runs on Psych). y/n included defensively.
Class methods
Escape a string for a double-quoted TOML basic string. Unlike Crystal's
String#inspect, this never emits TOML-invalid escapes (\a, \e,
\v) and leaves non-ASCII text raw — toml.cr's \uXXXX reader greedily
consumes a following hex digit, so escaping U+200B in "Autobuild" would
produce an unparseable file.
Quote a frontmatter key that isn't a bare TOML key (spaces, dots, non-ASCII — all valid in YAML/JSON source).
Serialize a frontmatter date/time value without corrupting the calendar day or the author's zone.
Frontmatter dates are commonly written as TOML/YAML local dates such
as 2026-05-20, which parse to midnight in the local time zone.
Rendering those through to_rfc3339 (always UTC) rolls the day back
in any positive-offset zone — e.g. in KST 2026-05-20 becomes
2026-05-19T15:00:00Z. When the value carries no time-of-day we emit
a bare YYYY-MM-DD; genuine timestamps keep their own offset
(to_rfc3339 would silently convert 08:00+09:00 to the previous
day's 23:00Z).
Convert a parsed TOML value into the YAML::Any tree the emitters
consume. Time leaves become frontmatter date strings (see
serialize_time).
Render a string as a YAML flow scalar, leaving simple values bare and
double-quoting anything YAML would reinterpret — beta: gamma parses
as a mapping, NO as false, 2024-01-15 as a date, *x as an alias.