feat(variants): document value format per option key in variant jsons

Every variants/<client>.json now carries a "_formats" map: behind each
option key, the form the value should take ("on|off", "hex color, e.g.
#123456", "plain px number, e.g. 15", "off | ./files/logo.png", font
slug, chooser mode + <key>custom, ...), derived from the mother config.xml
by variants/option_formats.php. variants/document_options.php refreshes the
map in every json (--check for staleness); build.php adds a hint when it
auto-adds a NEW option key to a json. _formats is documentation only and
never read by the build or the drift check.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-30 16:57:44 +01:00
commit f3d3912c2f

View file

@ -413,6 +413,19 @@ the variant's `preview.png` is identical to the mother's.
leave the rest empty. Legacy keys (e.g. `logotopmargin`, `<pos>logo`,
hex values in chooser options) are still accepted and migrated by
`build.php`, but writing the new-model keys directly is recommended.
The json also carries a **`_formats` map** that documents, behind each option
key, in which form the value should be filled in — e.g. `"on|off"`,
`"hex color, e.g. #123456"`, `"plain px number, e.g. 15"`,
`"off | ./files/logo.png"`, `"font value slug, e.g. \"inter\""`. Keep it up to
date during development with:
```
php variants/document_options.php <definitions-dir> # update _formats in every *.json
php variants/document_options.php <definitions-dir> --check # exit 1 when stale
```
The hints are derived from the mother `config.xml` (option type + options
list) via `variants/option_formats.php`; `build.php` also adds a hint when it
auto-adds a NEW option key to a json. `_formats` is documentation only — the
build never reads it and the drift check only looks inside `options`.
Naming convention: folder/json `respondage_<client>`, metadata `name`
`respondage_<client>` (must equal the file name), `title`
`"<Client> LimeSurvey theme"` (e.g. `respondage_acme` →