Extract calculator teaser metadata

This commit is contained in:
Codex
2026-03-07 09:37:19 +00:00
parent 824c270f95
commit 6bea84bbed
6 changed files with 743 additions and 426 deletions

View File

@@ -11,10 +11,9 @@ This repo now ships a **SvelteKit** experience that renders every conversion loc
- The **Active Calculators** table at the top is the single source of truth for every published conversion. Only entries listed here will appear in the generated data. Update this table before making any frontend changes.
- Column guidance:
- **Calculator Name**: keep the existing “Name descriptive teaser” format. The human-friendly phrase after the dash becomes the page subtitle.
- **Page Post ID / Kadence JS Element ID**: vestigial metadata from the previous architecture. Preserve the existing values if known, but the Svelte pipeline ignores them; you can leave them blank if you do not know them.
- **Slug**: lowercase, dash-separated, and unique. `migrate.py` uses this as the canonical identifier, so avoid spaces or special characters.
- **Conversion Factor**: this column is the only information `migrate.py` uses to infer the math. Simple multiplicative conversions should use the numeric multiplier that transforms the first unit into the second. Use `Linear Offset (m x + b)` when a fixed offset exists (e.g., `Linear Offset (1.8x + 32)` for Celsius → Fahrenheit), `1/x` for reciprocal conversions, `Multi-Variable` for compound calculators (amps, watts, lux, etc.), and tokens like `10_to_2`, `16_to_10`, `N/A (Text)`, or `Base` for number-system helpers. The script has heuristics built in for the most common patterns; if your calculator is unusual, see section 3 before rerunning.
- After the active table ends, keep the **Backlog** checklist intact. Move a row from the backlog into the table when it is ready for publication, then rerun the generator so the new slug actually ships.
- The completion checklist below the table should reflect the calculators that are currently shipped in Svelte. Keep it in sync with the active table whenever calculators are added or removed.
## 3. Generating the calculator data
- Every edit to the registry must be followed by `python migrate.py` executed from the repository root. The script reads `calculators_list.md`, applies heuristics to determine category/type/labels, and produces the updated `hdyc-svelte/src/lib/data/calculators.ts` file.