Canonical Wiki Paths Enforcement (#6)
### Summary - Change generated topdata wiki links to target public wiki namespace and canonical slug paths. - Add generated public path metadata to wiki page generation and page-index output. - Add YAML-driven generated slug overrides and public-target collision validation. ### Details - Generated relation links now render public targets such as: - `[[feat/hardiness-vs-enchantments|Hardiness vs. Enchantments]]` - `[[feat/favored-enemy-elves|Favored Enemy: Elves]]` - Topdata page IDs remain the internal identity for output layout, managed markers, deploy state, and bookkeeping. - Generated managed markers now include the effective public slug: - `<!-- sow-topdata-wiki:page=... wiki_slug=... -->` - Page-index entries now include: - `public_slug` - `public_target` - Added parsing and validation for `page_paths.slug_overrides` from `topdata/wiki/wiki.yaml`. - Generated public targets are validated for duplicate namespace-local collisions. - Table link helpers now derive public targets from target page titles when available, so display aliases do not accidentally change link destinations. ### Tests - Added and updated coverage for: - public target rendering - marker `wiki_slug` output - page-index public metadata - duplicate generated public target rejection - slug override parsing and validation - override-driven target selection - target title slugging independent of display labels ### Validation - `go test ./...` - `gofmt -w` on changed Go files - `./build-tool.sh` - `git diff --check` Reviewed-on: https://gitea.westgate.pw/ShadowsOverWestgate/sow-tools/pulls/6 Co-authored-by: vickydotbat <vickydotbat@tutamail.com> Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit is contained in:
@@ -813,8 +813,10 @@ func (p *wikiExprParser) callHelper(name string, args []any) (any, error) {
|
||||
if p.ctx != nil && !p.ctx.canReferenceWikiKey(key) {
|
||||
return "", nil
|
||||
}
|
||||
if pageID := wikiPageIDForKey(key); pageID != "" {
|
||||
key = pageID
|
||||
if p.ctx != nil {
|
||||
if target := p.ctx.publicWikiTargetForKey(key, ""); target != "" {
|
||||
key = target
|
||||
}
|
||||
}
|
||||
return "[[" + key + "]]", nil
|
||||
}
|
||||
@@ -827,8 +829,10 @@ func (p *wikiExprParser) callHelper(name string, args []any) (any, error) {
|
||||
if p.ctx != nil && !p.ctx.canReferenceWikiKey(key) {
|
||||
return "", nil
|
||||
}
|
||||
if pageID := wikiPageIDForKey(key); pageID != "" {
|
||||
key = pageID
|
||||
if p.ctx != nil {
|
||||
if target := p.ctx.publicWikiTargetForKey(key, label); target != "" {
|
||||
key = target
|
||||
}
|
||||
}
|
||||
return "[[" + key + "|" + label + "]]", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user