Unhardcode

This commit is contained in:
2026-05-25 10:23:42 +02:00
parent e6fffdf041
commit 7714c068fe
9 changed files with 286 additions and 23 deletions
+31
View File
@@ -432,6 +432,12 @@ topdata:
output_root: docs
pages_dir: pages
state_file: wiki-state.json
page_index_file: manifest/page-index.json
source: docs-src/wiki
data_file: providers/wiki-data.yaml
page_paths_file: paths/wiki-paths.yaml
page_templates_dir: page-fragments
manual_sections_file: sections/defaults.yaml
autogen:
cache:
root: "{paths.cache}/autogen"
@@ -460,6 +466,21 @@ autogen:
if got, want := proj.TopDataWikiStatePath(), filepath.Join(root, "cache", "docs", "wiki-state.json"); got != want {
t.Fatalf("expected wiki state path %s, got %s", want, got)
}
if got, want := proj.TopDataWikiPageIndexPath(), filepath.Join(root, "cache", "docs", "manifest", "page-index.json"); got != want {
t.Fatalf("expected wiki page-index path %s, got %s", want, got)
}
if got, want := proj.TopDataWikiDataPath(), filepath.Join(root, "docs-src", "wiki", "providers", "wiki-data.yaml"); got != want {
t.Fatalf("expected wiki data path %s, got %s", want, got)
}
if got, want := proj.TopDataWikiPagePathsPath(), filepath.Join(root, "docs-src", "wiki", "paths", "wiki-paths.yaml"); got != want {
t.Fatalf("expected wiki page paths path %s, got %s", want, got)
}
if got, want := proj.TopDataWikiPageTemplatesDir(), filepath.Join(root, "docs-src", "wiki", "page-fragments"); got != want {
t.Fatalf("expected wiki page template path %s, got %s", want, got)
}
if got, want := proj.TopDataWikiManualSectionsPath(), filepath.Join(root, "docs-src", "wiki", "sections", "defaults.yaml"); got != want {
t.Fatalf("expected wiki manual sections path %s, got %s", want, got)
}
if got, want := proj.AutogenCachePath("manifest.json"), filepath.Join(root, "cache", "autogen", "manifest.json"); got != want {
t.Fatalf("expected autogen cache path %s, got %s", want, got)
}
@@ -1179,6 +1200,11 @@ func TestValidateLayoutRejectsInvalidTopDataWikiConfig(t *testing.T) {
TablesFile: "../tables.yaml",
VisibilityFile: "../visibility.yaml",
TemplatesDir: ".",
DataFile: "../data.yaml",
PagePathsFile: "../wiki.yaml",
PageTemplatesDir: "../templates/pages",
ManualSectionsFile: "../manual/default.yaml",
PageIndexFile: "../page-index.json",
ManualSectionsDir: "../manual",
StalePages: TopDataWikiStalePagesConfig{
Default: "delete",
@@ -1202,6 +1228,11 @@ func TestValidateLayoutRejectsInvalidTopDataWikiConfig(t *testing.T) {
"topdata.wiki.tables_file",
"topdata.wiki.visibility_file",
"topdata.wiki.templates_dir",
"topdata.wiki.data_file",
"topdata.wiki.page_paths_file",
"topdata.wiki.page_templates_dir",
"topdata.wiki.manual_sections_file",
"topdata.wiki.page_index_file",
"topdata.wiki.manual_sections_dir",
"topdata.wiki.stale_pages.default",
"topdata.wiki.stale_pages.live_cleanup",