diff options
-rw-r--r-- | cmd/dlgbook/main.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/dlgbook/main.go b/cmd/dlgbook/main.go index c771f1e..fffa3f4 100644 --- a/cmd/dlgbook/main.go +++ b/cmd/dlgbook/main.go @@ -45,12 +45,14 @@ func formatAuthors(authors []string) string { s = s[:maxPartLength] } + s = strings.Map(stripNonLetters, s) + return s } // mapTitle is a function for strings.Map to strip out // unwanted characters from the title. -func mapTitle(r rune) rune { +func stripNonLetters(r rune) rune { if !unicode.IsLetter(r) { return -1 } @@ -60,7 +62,7 @@ func mapTitle(r rune) rune { // formatTitle formats a title to our preferences, notably // by stripping spaces and punctuation characters. func formatTitle(title string) string { - s := strings.Map(mapTitle, title) + s := strings.Map(stripNonLetters, title) if len(s) > maxPartLength { s = s[:maxPartLength] } |