mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 21:22:43 +00:00
feat(cli): preserve leading numeric prefixes in Blume group slugs
This commit is contained in:
1 parent
a2d32c5f06
commit
9d535c6826
2 files changed
+269
-7
No files matched your search
+8
-1
@@ -475,7 +475,14 @@ for (const sol of ordered) {
|
||||
// An unplanned problem's category may share a folder with a numbered topic
|
||||
// (`Hash Table` warm-ups under topic 1); the numbered one owns the meta.
|
||||
const topic = topics.get(sol.num) ?? { name: sol.category };
|
||||
const group = topic.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
||||
// Blume reads a leading `<digits>-` on a folder as a sidebar-order prefix and
|
||||
// strips it from the route (`1-d-…` → `/d-…`), so a slug that would start that
|
||||
// way keeps the digits glued to the next token (`1d-dynamic-programming`).
|
||||
const group = topic.name
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-|-$/g, "")
|
||||
.replace(/^(\d+)-/, "$1");
|
||||
if (groups.get(group)?.order === undefined) groups.set(group, topic);
|
||||
const name = `${group}/${sol.num}-${sol.slug}.mdx`;
|
||||
const existing = pages.get(sol.num);
|
||||
|
||||
Reference in new issue
Block a user