diff --git a/pipelines/songs/README.md b/pipelines/songs/README.md index e1fbdcc..f89283e 100644 --- a/pipelines/songs/README.md +++ b/pipelines/songs/README.md @@ -13,7 +13,7 @@ Implemented: - Pandoc-based markdown → wikitext body rendering - First-line h1 stripping - Auto-generated banner (`{{Auto-generated|source=...|commit=}}`) -- Album category injection (`[[Category:Album:]]`); additional categories via `categories` list +- Album category injection (`[[Category:Songs]]` + `[[Category:Album:]]` when `album` is set); additional categories via `categories` list - LRC file upload (idempotent SHA1 check) + footer link - Inter-page sibling placeholder resolution (`[[TAG]]` → `[[wiki page title|label]]`) - MediaWiki bot API write with idempotency — no-op if wiki content matches generated output @@ -80,7 +80,7 @@ The pipeline always runs `--all`: every file with `wiki.publish: true` (not unde | Body rendering | Pandoc-based, with a thin Python pre/post-processor | 2026-06-09 | | Excluded paths | `wip/**`, plus repo-meta files | 2026-06-09 | | Page template | Designed from scratch (no existing wiki pages to mirror) | 2026-06-09 | -| Album categories | Auto-injected `[[Category:Album:]]`; category page is user-written and not overwritten | 2026-06-09 | +| Album categories | Auto-injected `[[Category:Songs]]` + `[[Category:Album:]]` when `album` is set; category pages are user-written and not overwritten | 2026-06-09 | | Additional categories | Optional `categories` list in frontmatter; each entry → `[[Category:]]` | 2026-06-10 | | `album` optional | Companion/sibling pages don't need an album; omitting the field emits no album category | 2026-06-10 | | Sibling resolution | Parent declares siblings as a bill of materials (`path` + `tag` + optional `label`); `[[TAG]]` substituted post-Pandoc | 2026-06-10 | diff --git a/pipelines/songs/SCHEMA.md b/pipelines/songs/SCHEMA.md index ee72281..1981648 100644 --- a/pipelines/songs/SCHEMA.md +++ b/pipelines/songs/SCHEMA.md @@ -51,11 +51,11 @@ Files under `wip/` are also skipped, regardless of `wiki.publish`. #### `album` (string) -The full album name. Drives `[[Category:Album:]]` injection at the bottom of the rendered wiki page. +The full album name. Drives `[[Category:Songs]]` and `[[Category:Album:]]` injection at the bottom of the rendered wiki page. -Example: `album: Shirakaba Express Service` → category tag `[[Category:Album:Shirakaba Express Service]]`. +Example: `album: Shirakaba Express Service` → category tags `[[Category:Songs]]` and `[[Category:Album:Shirakaba Express Service]]`. -Pages without an album (companion documents, placeholders, songs without an assigned album) simply omit this field — no category is injected unless `categories` provides one. +Pages without an album (companion documents, placeholders, songs without an assigned album) simply omit this field — neither category is injected unless `categories` provides one. #### `categories` (list of strings) @@ -139,7 +139,7 @@ For each `.md` with `wiki.publish: true` and not under `wip/`: 4. Substitute `TAG` placeholders with resolved `[[Page|Display]]` wikilinks (or fallback text). 5. Prepend the auto-generated banner: `{{Auto-generated|source=|commit=}}`. 6. If `lrc` is declared: upload the LRC file if its SHA1 has changed; append a `[[Media:…]]` link. -7. Append category tags: `[[Category:Album:]]` if `album` is set; `[[Category:]]` for each entry in `categories`. +7. Append category tags: `[[Category:Songs]]` and `[[Category:Album:]]` if `album` is set; `[[Category:]]` for each entry in `categories`. 8. Read the current wiki page content via the MediaWiki API; if identical to the generated output, skip the write (idempotency — keeps the wiki history clean). 9. If the page exists and does not start with `{{Auto-generated`, skip with a warning (manual page protection). 10. Otherwise, write the page with an edit summary referencing the source commit. @@ -152,7 +152,7 @@ For each `.md` with `wiki.publish: true` and not under `wip/`: - Banner template injection - LRC file upload and footer link - Sibling placeholder resolution (`[[TAG]]` → `[[wiki page title|label]]`) -- Album category injection (`[[Category:Album:]]`) +- Album category injection (`[[Category:Songs]]` + `[[Category:Album:]]`) when `album` is set - Additional categories via `categories` list - Idempotent writes (no-op skip when content matches) - Manual-page protection (skip pages without auto-gen banner) diff --git a/pipelines/songs/publish.py b/pipelines/songs/publish.py index 7e8e14c..f87cc78 100644 --- a/pipelines/songs/publish.py +++ b/pipelines/songs/publish.py @@ -106,6 +106,7 @@ def build_wikitext(fm: dict, body_wikitext: str, source_url: str, source_ref: st cat_parts = [] if fm.get("album"): + cat_parts.append(f"[[Category:Songs]]") cat_parts.append(f"[[Category:Album:{fm['album']}]]") for cat in (fm.get("categories") or []): cat_parts.append(f"[[Category:{cat}]]")