diff --git a/archive/threads/NOTimothyLottes/2023-08-03-spc-using-8-deep-swap-all-aliasing-same-bo-image/index.md b/archive/threads/NOTimothyLottes/2023-08-03-spc-using-8-deep-swap-all-aliasing-same-bo-image/index.md index 6500418..935daf0 100644 --- a/archive/threads/NOTimothyLottes/2023-08-03-spc-using-8-deep-swap-all-aliasing-same-bo-image/index.md +++ b/archive/threads/NOTimothyLottes/2023-08-03-spc-using-8-deep-swap-all-aliasing-same-bo-image/index.md @@ -8,7 +8,7 @@ handle: NOTimothyLottes post_id: "1687062786273062912" date: 2023-08-03 archived: 2026-08-23 -draft: true +draft: false tags: - archive - twitter diff --git a/archive/threads/NOTimothyLottes/index.md b/archive/threads/NOTimothyLottes/index.md index 7079192..f11dd5b 100644 --- a/archive/threads/NOTimothyLottes/index.md +++ b/archive/threads/NOTimothyLottes/index.md @@ -10,7 +10,7 @@ tags: --- - [[archive/threads/NOTimothyLottes/2022-11-04-vulkan-1500-lines-of-overhead-including-header]] -- [[archive/threads/NOTimothyLottes/2022-11-05-19-even-without-double-rate-16-bit-16-bit-is-the]] +- [[archive/threads/NOTimothyLottes/2022-11-05-19-GPU-Programming-Tip-Line-Thread]] - [[archive/threads/NOTimothyLottes/2022-11-08-example-of-bind-everything-once-layout-aliasing]] - [[archive/threads/NOTimothyLottes/2022-11-09-if-only-pc-vendors-with-open-isas-amd-intel-would]] - [[archive/threads/NOTimothyLottes/2022-11-13-my-prefered-method-of-managing-application-data]] diff --git a/scripts/twitter/emit_archive.py b/scripts/twitter/emit_archive.py index 7a3d334..0f576c8 100644 --- a/scripts/twitter/emit_archive.py +++ b/scripts/twitter/emit_archive.py @@ -269,22 +269,32 @@ def _split_frontmatter(text: str) -> tuple[str, str]: def _upsert_wikilink(path: Path, target: str) -> None: + """Insert or move a wikilink target on the handle index. + + If the handle folder contains a directory whose name matches `target`, + any other wikilink whose basename does not match a real directory is + dropped. This keeps the handle index in sync when a folder is reused + with a new slug (e.g., a tip-climb refresh renames the folder). + """ text = path.read_text(encoding="utf-8") fm, body = _split_frontmatter(text) kept: list[str] = [] names: list[str] = [] + handle_dir = path.parent + real_dirs = {d.name for d in handle_dir.iterdir() if d.is_dir()} if handle_dir.is_dir() else set() for line in body.splitlines(): match = _WIKILINK_ITEM.match(line) if match: name = match.group(1) - if name not in names: - names.append(name) + # Drop stale wikilinks whose folder no longer exists under + # this handle. Same-slug duplicates still get collapsed. + if name in real_dirs or not real_dirs: + if name not in names: + names.append(name) else: kept.append(line) if target not in names: names.append(target) - short = target.rsplit("/", 1)[-1] - names = [n for n in names if n == target or n != short] names.sort() while kept and kept[0] == "": kept.pop(0)