fix(songs): sibling substitution uses bare tag match, not [[TAG]] wrapper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 00:46:57 +09:00
parent 87874fa935
commit f2fe4da667
2 changed files with 8 additions and 8 deletions
+7 -7
View File
@@ -22,7 +22,7 @@ lrc: pulse.lrc
# pulse under latent semantic envelopes # 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. 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 | | Field | Required for resolution | Purpose |
|---|---|---| |---|---|---|
| `path` | yes | Relative path to the sibling `.md` file | | `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 | | `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:** **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, `label` present | `[[wiki page title\|label]]` |
| `path` resolves to a published page, no `label` | `[[wiki page title]]` | | `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: Plain markdown. The renderer applies two transformations before and after Pandoc:
1. **Pre-Pandoc**: strip the first-line `# Heading` if present. 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. 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. 1. Parse and validate frontmatter.
2. Strip the leading `# Heading` from the body if present. 2. Strip the leading `# Heading` from the body if present.
3. Pipe the body through `pandoc -f markdown -t mediawiki`. 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=<source URL>|commit=<sha>}}`. 5. Prepend the auto-generated banner: `{{Auto-generated|source=<source URL>|commit=<sha>}}`.
6. If `lrc` is declared: upload the LRC file if its SHA1 has changed; append a `[[Media:…]]` link. 6. If `lrc` is declared: upload the LRC file if its SHA1 has changed; append a `[[Media:…]]` link.
7. Append category tags: `[[Category:Album:<album>]]` if `album` is set; `[[Category:<cat>]]` for each entry in `categories`. 7. Append category tags: `[[Category:Album:<album>]]` if `album` is set; `[[Category:<cat>]]` for each entry in `categories`.
+1 -1
View File
@@ -96,7 +96,7 @@ def apply_sibling_substitutions(wikitext: str, this_path: Path, fm_wiki: dict, s
replacement = label replacement = label
else: else:
replacement = tag replacement = tag
wikitext = wikitext.replace(f"[[{tag}]]", replacement) wikitext = wikitext.replace(tag, replacement)
return wikitext return wikitext