Fix Wiki Deploy Post Titles

This commit is contained in:
2026-04-30 20:17:02 +02:00
parent f480815e5d
commit 78133efdf4
4 changed files with 87 additions and 1 deletions
+17
View File
@@ -238,6 +238,7 @@ func planNodeBBDeploy(pages map[string]wikiDeployPage, manifest wikiDeployManife
return nil, result, next, fmt.Errorf("wiki page %q requires --category %s=<cid> for creation", pageID, page.Namespace)
}
result.Created++
page.Title = nodeBBTopicTitle(page)
plans = append(plans, wikiDeployPlan{Page: page, Entry: entry, Action: "create", Content: page.Content})
continue
}
@@ -347,6 +348,22 @@ func extractHTMLTitle(content, fallback string) string {
return namespaceTitle(parts[len(parts)-1])
}
func nodeBBTopicTitle(page wikiDeployPage) string {
title := strings.TrimSpace(page.Title)
if len([]rune(title)) >= 5 {
return title
}
namespace := strings.TrimSpace(namespaceTitle(page.Namespace))
if namespace == "" {
namespace = "Wiki"
}
if title == "" {
parts := strings.Split(page.PageID, ":")
title = namespaceTitle(parts[len(parts)-1])
}
return namespace + ": " + title
}
func stripSimpleTags(text string) string {
var out strings.Builder
inTag := false