refactor: drop the mojibake workaround from slugifyStem
slugifyStem carried `.replaceAll('ΓÇÖ', "'")`, which patched a corrupted
apostrophe at the slug layer so three notes with mojibake filenames still
produced correct URLs. The underlying filenames are now repaired, so no stem
contains that sequence and the line is dead code that encodes an assumption
which is no longer true.
Proved it is dead rather than assuming: rebuilt and diffed all 411 generated
slugs against the previous build - identical, nothing moved.
The unit test asserted against the corrupted string, so it was testing the
workaround rather than the behaviour. It now uses the real repaired stem,
'A Farfetch’D Story', which exercises the same thing that actually matters -
that U+2019 becomes a hyphen - and still expects 'a-farfetch-d-story'. Added a
case for 'Fused Dimensions' to pin the non-breaking-space folding, since that
name previously carried U+00A0.
Also syncs the catalog for the Fused Dimensions rename. Verified: npm run check
(0 errors, vitest 9/9), npm run build (486 pages), CI=1 npm run test:ui (8/8),
deployed; live 200 on all seven repaired URLs and the h1 renders without NBSP.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e9334f73e8
commit
4e0c285347
3 files changed
+5
-5
No files matched your search
+2
-2
@@ -7864,8 +7864,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stem": "Fused Dimensions",
|
"stem": "Fused Dimensions",
|
||||||
"title": "Pokémon Fused Dimensions",
|
"title": "Pokémon Fused Dimensions",
|
||||||
"platform": "GBA",
|
"platform": "GBA",
|
||||||
"base": "FireRed",
|
"base": "FireRed",
|
||||||
"version": null,
|
"version": null,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const baseCatalog: RawCatalog = {
|
|||||||
links: [{ label: 'Source / info', url: 'https://example.com/radical' }],
|
links: [{ label: 'Source / info', url: 'https://example.com/radical' }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
stem: 'A FarfetchΓÇÖD Story',
|
stem: 'A Farfetch’D Story',
|
||||||
title: 'Pokémon A Farfetch’D Story',
|
title: 'Pokémon A Farfetch’D Story',
|
||||||
platform: 'PC',
|
platform: 'PC',
|
||||||
base: null,
|
base: null,
|
||||||
@@ -89,7 +89,8 @@ const baseCatalog: RawCatalog = {
|
|||||||
describe('catalog normalization', () => {
|
describe('catalog normalization', () => {
|
||||||
it('creates deterministic URL-safe slugs from stems', () => {
|
it('creates deterministic URL-safe slugs from stems', () => {
|
||||||
expect(slugifyStem('Radical Red')).toBe('radical-red');
|
expect(slugifyStem('Radical Red')).toBe('radical-red');
|
||||||
expect(slugifyStem('A FarfetchΓÇÖD Story')).toBe('a-farfetch-d-story');
|
expect(slugifyStem('A Farfetch’D Story')).toBe('a-farfetch-d-story');
|
||||||
|
expect(slugifyStem('Fused Dimensions')).toBe('fused-dimensions');
|
||||||
expect(slugifyStem('Pokémon: Crystal Clear!')).toBe('pokemon-crystal-clear');
|
expect(slugifyStem('Pokémon: Crystal Clear!')).toBe('pokemon-crystal-clear');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ export function normalizeHack(raw: RawHack): SiteHack {
|
|||||||
|
|
||||||
export function slugifyStem(stem: string): string {
|
export function slugifyStem(stem: string): string {
|
||||||
return stem
|
return stem
|
||||||
.replaceAll('ΓÇÖ', "'")
|
|
||||||
.normalize('NFKD')
|
.normalize('NFKD')
|
||||||
.replace(/[\u0300-\u036f]/g, '')
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
.replace(/[^a-zA-Z0-9]+/g, '-')
|
.replace(/[^a-zA-Z0-9]+/g, '-')
|
||||||
|
|||||||
Reference in new issue
Block a user