refactor(docs): replace deprecated strings.Title with cases.Title
strings.Title has been deprecated since Go 1.18 because it does not handle Unicode properly. Replace it with cases.Title from golang.org/x/text which correctly handles language-specific title casing. Applied to breadcrumb generation and document title formatting.
This commit is contained in:
@@ -5,6 +5,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"bookhoard/templates"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
// BuildNavigation creates the navigation structure from the docs filesystem
|
||||
@@ -100,7 +103,7 @@ func (h *DocsHandler) getDocTitle(docPath string) string {
|
||||
filename := parts[len(parts)-1]
|
||||
|
||||
// Convert to title case
|
||||
title = strings.Title(strings.ReplaceAll(filename, "-", " "))
|
||||
title = cases.Title(language.English).String(strings.ReplaceAll(filename, "-", " "))
|
||||
|
||||
// Handle special cases
|
||||
switch filename {
|
||||
|
||||
Reference in New Issue
Block a user