Topdata wiki alignment links
This commit is contained in:
@@ -1312,6 +1312,31 @@ func TestWikiTemplateFormatsPreferredAlignmentsWithConfiguredLinks(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWikiTemplateFormatsPreferredAlignmentsWithConfiguredRootAnchors(t *testing.T) {
|
||||
ctx := &wikiContext{
|
||||
alignmentLinkPattern: "/wiki/Guides/Alignment/{alignment}",
|
||||
alignmentLinkFormat: "html_anchor",
|
||||
}
|
||||
page := wikiTemplatePage{
|
||||
PageID: "racialtypes:tiefling",
|
||||
Category: "racialtypes",
|
||||
Key: "racialtypes:tiefling",
|
||||
Title: "Tiefling",
|
||||
Row: map[string]any{
|
||||
"PreferredAlignments": map[string]any{"list": []any{"le"}},
|
||||
},
|
||||
}
|
||||
|
||||
got, err := ctx.renderWikiTemplateString("racialtypes.html", `{{alignments(PreferredAlignments)}}`, page)
|
||||
if err != nil {
|
||||
t.Fatalf("render template: %v", err)
|
||||
}
|
||||
want := `<a class="wiki-internal-link" href="/wiki/Guides/Alignment/Lawful_Evil">Lawful Evil</a>`
|
||||
if got != want {
|
||||
t.Fatalf("expected %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWikiTemplateDescriptionFiltersExtractParagraphsAndSections(t *testing.T) {
|
||||
ctx := &wikiContext{}
|
||||
page := wikiTemplatePage{
|
||||
|
||||
Reference in New Issue
Block a user