Template flow cleaned up

This commit is contained in:
adilallo
2026-04-20 16:45:15 -06:00
parent d3bb8cdd0f
commit c08cd62872
32 changed files with 1545 additions and 254 deletions
+2 -12
View File
@@ -1,3 +1,4 @@
import { methodSlugFromTitle } from "../create/methodSlugFromTitle";
import type { SectionId } from "./validation/methodFacetsSchemas";
/**
@@ -21,18 +22,7 @@ const CATEGORY_NAME_TO_SECTION: Record<string, SectionId> = {
"Conflict management": "conflictManagement",
};
export function methodSlugFromTitle(title: string): string {
// Match the slugify rules of the one-time messages ingest: NFKD-normalize,
// strip diacritics, drop apostrophes/brackets, collapse non-alphanumerics
// to single hyphens, trim leading/trailing hyphens.
const folded = title.normalize("NFKD").replace(/[\u0300-\u036f]/g, "");
const stripped = folded
.toLowerCase()
.replace(/['`()\[\]]/g, "")
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
return stripped;
}
export { methodSlugFromTitle };
type RuleTemplateBodySection = {
categoryName?: unknown;