Topdata wiki alignment links

This commit is contained in:
2026-05-25 10:31:07 +02:00
parent 7714c068fe
commit a646c905e4
7 changed files with 126 additions and 68 deletions
+51 -44
View File
@@ -294,6 +294,7 @@ type TopDataWikiConfig struct {
type TopDataWikiAlignmentLinks struct {
TargetPattern string `json:"target_pattern" yaml:"target_pattern"`
LinkFormat string `json:"link_format" yaml:"link_format"`
}
type TopDataWikiStalePagesConfig struct {
@@ -567,50 +568,51 @@ func (p *Project) ValidateLayout() error {
failures = append(failures, errors.New("at least one of paths.source, paths.assets, or topdata.source is required"))
}
for field, value := range map[string]string{
"paths.source": p.Config.Paths.Source,
"paths.assets": p.Config.Paths.Assets,
"paths.build": p.Config.Paths.Build,
"paths.cache": p.Config.Paths.Cache,
"paths.tools": p.Config.Paths.Tools,
"outputs.module_archive": p.Config.Outputs.ModuleArchive,
"outputs.hak_manifest": p.Config.Outputs.HAKManifest,
"outputs.hak_archive": p.Config.Outputs.HAKArchive,
"generated_assets.topdata_2da": "",
"validation.profile": p.Config.Validation.Profile,
"scripts.source_dir": p.Config.Scripts.SourceDir,
"scripts.cache": p.Config.Scripts.Cache,
"scripts.compiler.path": p.Config.Scripts.Compiler.Path,
"scripts.compiler.env.path": p.Config.Scripts.Compiler.Env.Path,
"topdata.source": p.Config.TopData.Source,
"topdata.build": p.Config.TopData.Build,
"topdata.reference_builder": p.Config.TopData.ReferenceBuilder,
"topdata.assets": p.Config.TopData.Assets,
"topdata.compiled_2da_dir": p.Config.TopData.Compiled2DADir,
"topdata.compiled_tlk": p.Config.TopData.CompiledTLK,
"topdata.wiki.output_root": p.Config.TopData.Wiki.OutputRoot,
"topdata.wiki.pages_dir": p.Config.TopData.Wiki.PagesDir,
"topdata.wiki.state_file": p.Config.TopData.Wiki.StateFile,
"topdata.wiki.deploy_manifest": p.Config.TopData.Wiki.DeployManifest,
"topdata.wiki.deploy_edit_summary": p.Config.TopData.Wiki.DeployEditSummary,
"topdata.wiki.source": p.Config.TopData.Wiki.Source,
"topdata.wiki.namespaces_file": p.Config.TopData.Wiki.NamespacesFile,
"topdata.wiki.tables_file": p.Config.TopData.Wiki.TablesFile,
"topdata.wiki.visibility_file": p.Config.TopData.Wiki.VisibilityFile,
"topdata.wiki.data_file": p.Config.TopData.Wiki.DataFile,
"topdata.wiki.page_paths_file": p.Config.TopData.Wiki.PagePathsFile,
"topdata.wiki.templates_dir": p.Config.TopData.Wiki.TemplatesDir,
"topdata.wiki.page_templates_dir": p.Config.TopData.Wiki.PageTemplatesDir,
"topdata.wiki.manual_sections_dir": p.Config.TopData.Wiki.ManualSectionsDir,
"topdata.wiki.manual_sections_file": p.Config.TopData.Wiki.ManualSectionsFile,
"topdata.wiki.page_index_file": p.Config.TopData.Wiki.PageIndexFile,
"extract.layout": p.Config.Extract.Layout,
"extract.hak_discovery": p.Config.Extract.HAKDiscovery,
"autogen.cache.root": p.Config.Autogen.Cache.Root,
"autogen.cache.max_age": p.Config.Autogen.Cache.MaxAge,
"autogen.cache.refresh_env": p.Config.Autogen.Cache.RefreshEnv,
"autogen.release_source.provider": p.Config.Autogen.ReleaseSource.Provider,
"autogen.release_source.server_url_env": p.Config.Autogen.ReleaseSource.ServerURLEnv,
"autogen.release_source.repo_env": p.Config.Autogen.ReleaseSource.RepoEnv,
"paths.source": p.Config.Paths.Source,
"paths.assets": p.Config.Paths.Assets,
"paths.build": p.Config.Paths.Build,
"paths.cache": p.Config.Paths.Cache,
"paths.tools": p.Config.Paths.Tools,
"outputs.module_archive": p.Config.Outputs.ModuleArchive,
"outputs.hak_manifest": p.Config.Outputs.HAKManifest,
"outputs.hak_archive": p.Config.Outputs.HAKArchive,
"generated_assets.topdata_2da": "",
"validation.profile": p.Config.Validation.Profile,
"scripts.source_dir": p.Config.Scripts.SourceDir,
"scripts.cache": p.Config.Scripts.Cache,
"scripts.compiler.path": p.Config.Scripts.Compiler.Path,
"scripts.compiler.env.path": p.Config.Scripts.Compiler.Env.Path,
"topdata.source": p.Config.TopData.Source,
"topdata.build": p.Config.TopData.Build,
"topdata.reference_builder": p.Config.TopData.ReferenceBuilder,
"topdata.assets": p.Config.TopData.Assets,
"topdata.compiled_2da_dir": p.Config.TopData.Compiled2DADir,
"topdata.compiled_tlk": p.Config.TopData.CompiledTLK,
"topdata.wiki.output_root": p.Config.TopData.Wiki.OutputRoot,
"topdata.wiki.pages_dir": p.Config.TopData.Wiki.PagesDir,
"topdata.wiki.state_file": p.Config.TopData.Wiki.StateFile,
"topdata.wiki.deploy_manifest": p.Config.TopData.Wiki.DeployManifest,
"topdata.wiki.deploy_edit_summary": p.Config.TopData.Wiki.DeployEditSummary,
"topdata.wiki.source": p.Config.TopData.Wiki.Source,
"topdata.wiki.namespaces_file": p.Config.TopData.Wiki.NamespacesFile,
"topdata.wiki.tables_file": p.Config.TopData.Wiki.TablesFile,
"topdata.wiki.visibility_file": p.Config.TopData.Wiki.VisibilityFile,
"topdata.wiki.data_file": p.Config.TopData.Wiki.DataFile,
"topdata.wiki.page_paths_file": p.Config.TopData.Wiki.PagePathsFile,
"topdata.wiki.templates_dir": p.Config.TopData.Wiki.TemplatesDir,
"topdata.wiki.page_templates_dir": p.Config.TopData.Wiki.PageTemplatesDir,
"topdata.wiki.manual_sections_dir": p.Config.TopData.Wiki.ManualSectionsDir,
"topdata.wiki.manual_sections_file": p.Config.TopData.Wiki.ManualSectionsFile,
"topdata.wiki.page_index_file": p.Config.TopData.Wiki.PageIndexFile,
"topdata.wiki.alignment_links.link_format": p.Config.TopData.Wiki.AlignmentLinks.LinkFormat,
"extract.layout": p.Config.Extract.Layout,
"extract.hak_discovery": p.Config.Extract.HAKDiscovery,
"autogen.cache.root": p.Config.Autogen.Cache.Root,
"autogen.cache.max_age": p.Config.Autogen.Cache.MaxAge,
"autogen.cache.refresh_env": p.Config.Autogen.Cache.RefreshEnv,
"autogen.release_source.provider": p.Config.Autogen.ReleaseSource.Provider,
"autogen.release_source.server_url_env": p.Config.Autogen.ReleaseSource.ServerURLEnv,
"autogen.release_source.repo_env": p.Config.Autogen.ReleaseSource.RepoEnv,
} {
if strings.Contains(value, "\x00") {
failures = append(failures, fmt.Errorf("%s must not contain NUL bytes", field))
@@ -674,6 +676,11 @@ func (p *Project) ValidateLayout() error {
default:
failures = append(failures, fmt.Errorf("topdata.wiki.link_strategy %q is not supported", effective.TopData.Wiki.LinkStrategy))
}
switch effective.TopData.Wiki.AlignmentLinks.LinkFormat {
case "wiki_markup", "html_anchor":
default:
failures = append(failures, fmt.Errorf("topdata.wiki.alignment_links.link_format %q is not supported", effective.TopData.Wiki.AlignmentLinks.LinkFormat))
}
if effective.TopData.Wiki.TitlePrefixMinLength < 1 {
failures = append(failures, fmt.Errorf("topdata.wiki.title_prefix_min_length must be at least 1"))
}