From f2fe4da66755a6e767dcebea2af9e67740cfe6c7 Mon Sep 17 00:00:00 2001 From: Mikkeli Matlock Date: Wed, 10 Jun 2026 00:46:57 +0900 Subject: [PATCH] fix(songs): sibling substitution uses bare tag match, not [[TAG]] wrapper Co-Authored-By: Claude Sonnet 4.6 --- pipelines/songs/SCHEMA.md | 14 +++++++------- pipelines/songs/publish.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pipelines/songs/SCHEMA.md b/pipelines/songs/SCHEMA.md index d722d1d..ee72281 100644 --- a/pipelines/songs/SCHEMA.md +++ b/pipelines/songs/SCHEMA.md @@ -22,7 +22,7 @@ lrc: pulse.lrc # pulse under latent semantic envelopes -... body markdown, [[PULSE_DEV]] used inline ... +... body markdown, PULSE_DEV used inline ... ``` The renderer parses the frontmatter, validates required fields, then hands the body (with the first `# Heading` line removed) to Pandoc, then applies sibling substitutions on the wikitext output. @@ -98,16 +98,16 @@ wiki: | Field | Required for resolution | Purpose | |---|---|---| | `path` | yes | Relative path to the sibling `.md` file | -| `tag` | yes | Placeholder identifier; pipeline hunts for `[[TAG]]` in the rendered wikitext | +| `tag` | yes | Placeholder identifier; pipeline does a case-sensitive string replace of `TAG` in the rendered wikitext | | `label` | no | Display text for the resolved link | -An entry missing either `path` or `tag` is silently skipped — no substitution is attempted and any `[[TAG]]` in the body passes through as a literal wikilink to a page named `TAG`. +An entry missing either `path` or `tag` is silently skipped — no substitution is attempted for that entry. **Resolution:** -The pipeline resolves each declared sibling's `path` to its wiki page title by looking it up in the set of all publishable files processed in the same run. Substitution rules: +The pipeline resolves each declared sibling's `path` to its wiki page title by looking it up in the set of all publishable files processed in the same run. Substitution is a case-sensitive string replace of the bare tag. Substitution rules: -| Condition | `[[TAG]]` becomes | +| Condition | `TAG` becomes | |---|---| | `path` resolves to a published page, `label` present | `[[wiki page title\|label]]` | | `path` resolves to a published page, no `label` | `[[wiki page title]]` | @@ -125,7 +125,7 @@ The siblings list is a bill of materials — declaring a sibling has no effect u Plain markdown. The renderer applies two transformations before and after Pandoc: 1. **Pre-Pandoc**: strip the first-line `# Heading` if present. -2. **Post-Pandoc**: substitute `[[TAG]]` placeholders declared in `wiki.siblings`. +2. **Post-Pandoc**: substitute `TAG` placeholders declared in `wiki.siblings`. Do not embed raw wikitext-specific syntax (`{{Template}}`, raw `[[Wikilink]]` not declared via `siblings`, etc.) in the body unless you intend the literal output. Use markdown idioms; the renderer adds the metadata-derived bits (banner, LRC link, categories, sibling resolution) around Pandoc's output. @@ -136,7 +136,7 @@ For each `.md` with `wiki.publish: true` and not under `wip/`: 1. Parse and validate frontmatter. 2. Strip the leading `# Heading` from the body if present. 3. Pipe the body through `pandoc -f markdown -t mediawiki`. -4. Substitute `[[TAG]]` placeholders with resolved `[[Page|Display]]` wikilinks (or fallback text). +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`. diff --git a/pipelines/songs/publish.py b/pipelines/songs/publish.py index 857f515..7e8e14c 100644 --- a/pipelines/songs/publish.py +++ b/pipelines/songs/publish.py @@ -96,7 +96,7 @@ def apply_sibling_substitutions(wikitext: str, this_path: Path, fm_wiki: dict, s replacement = label else: replacement = tag - wikitext = wikitext.replace(f"[[{tag}]]", replacement) + wikitext = wikitext.replace(tag, replacement) return wikitext