Reads the YAML tables under priv/ and writes lib/locale_slug/generated_tables.ex.
The generated file is committed. That is what lets yamerl be a dev-only
dependency and the shipped package carry no dependencies at all — a consumer
compiles plain Elixir. test/generated_tables_test.exs regenerates in a temp dir and
fails if the committed file has drifted, so the two cannot silently diverge.
mix locale_slug.gen # regenerate
mix locale_slug.gen --check # exit 1 if the committed file is staleValidation happens here, not at runtime
A bad table should break the build of whoever wrote it, not produce a quietly wrong URL for someone downstream. Rejected:
- an output containing anything but
[a-z0-9]or the separator token — including a literal-, since hardcoding it would defeatseparator: "_" - a rule list whose last branch carries a condition (no default), or where a default appears anywhere but last
word_finalconjoined withfollowed_by— unsatisfiable: if the match ends the word there is no following grapheme to classify- an L0 key longer than one grapheme, which would break the engine's guarantee that cross-layer competition is always a length tie
- a class containing
σbut notς— final sigma is not the canonical base of sigma, and step 1 creates it by lowercasing word-finalΣ - a key whose lowercase form differs from itself (tables are keyed lowercased)
Summary
Functions
Loads and validates every table under dir, returning %{base:, scripts:, locales:}.
The source that run/1 would write, without writing it.
Functions
Loads and validates every table under dir, returning %{base:, scripts:, locales:}.
Public so the validation tests can point it at a temp directory of deliberately broken tables. Every guard in this module is a reason a bad table never reaches a URL, which makes them worth testing directly rather than trusting.
The source that run/1 would write, without writing it.
Exists so the drift test can compare against the committed file in-process rather
than shelling out to a second mix run.