all: Remove unused code

Using x/tools/cmd/deadcode
This commit is contained in:
Bjørn Erik Pedersen
2023-12-18 17:41:15 +01:00
parent 6f13430d4a
commit 8adba648cc
30 changed files with 32 additions and 405 deletions

View File

@@ -266,24 +266,3 @@ func (c *ContentSpec) TrimShortHTML(input []byte) []byte {
func isEndOfSentence(r rune) bool {
return r == '.' || r == '?' || r == '!' || r == '"' || r == '\n'
}
// Kept only for benchmark.
func (c *ContentSpec) truncateWordsToWholeSentenceOld(content string) (string, bool) {
words := strings.Fields(content)
if c.Cfg.SummaryLength() >= len(words) {
return strings.Join(words, " "), false
}
for counter, word := range words[c.Cfg.SummaryLength():] {
if strings.HasSuffix(word, ".") ||
strings.HasSuffix(word, "?") ||
strings.HasSuffix(word, ".\"") ||
strings.HasSuffix(word, "!") {
upper := c.Cfg.SummaryLength() + counter + 1
return strings.Join(words[:upper], " "), (upper < len(words))
}
}
return strings.Join(words[:c.Cfg.SummaryLength()], " "), true
}