Fix Wiki Deploy Post Titles
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user