Skip to content

refactor(types,web): migrate usc_title to string for alphanumeric titles and appendices - #283

Merged
williamzujkowski merged 1 commit into
mainfrom
refactor/usc-title-string-support
Oct 6, 2026
Merged

williamzujkowski merged 1 commit into
mainfrom
refactor/usc-title-string-support

Conversation

@williamzujkowski

Copy link
Copy Markdown
Collaborator

Description

Migrates usc_title to support string values throughout the transformer frontmatter, Astro content collection schema, routing, and UI presentation. This ensures titles with letter suffixes (such as Title 18 Appendix 18a, 5a, 26a, etc.) are preserved without numeric truncation or collision.

Key Changes

  • Frontmatter Validation: Updated FrontmatterSchema in packages/transformer/src/markdown-generator.ts to accept z.union([z.string().min(1), z.number().int().positive()]).transform(String).
  • YAML Serialization: generateFrontmatter outputs numbers for pure numeric titles and quoted strings for alphanumeric titles.
  • Section Generation: generateMarkdownForSection preserves titleNum as a trimmed string instead of forcing parseInt.
  • Astro Content Schema: Updated apps/web/src/content.config.ts to accept string | number transformed to string.
  • Navigation & Routing: Fixed browse/[title].astro and statute/[...slug].astro to support string keys.
  • Title Dictionary: Added Title appendix entries (5a, 11a, 18a, 26a, 28a, 50a) to TITLE_NAMES in apps/web/src/data/title-names.ts.
  • Natural Collation: Updated title list sorting in browse/index.astro to use localeCompare with numeric collation.

Closes #278

…les and appendices

Support alphanumeric title keys (such as 18a, 5a, 26a) and appendices across transformer frontmatter, Astro collections, routes, and natural collation.

Closes #278
@williamzujkowski
williamzujkowski requested a review from a team as a code owner October 6, 2026 14:47
@williamzujkowski
williamzujkowski merged commit a3d1b85 into main Oct 6, 2026
3 checks passed
@williamzujkowski
williamzujkowski deleted the refactor/usc-title-string-support branch October 6, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(types,web): migrate usc_title to string to support alphanumeric titles and appendices

1 participant