diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-12-18 17:41:15 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-12-18 19:51:26 +0100 |
commit | 8adba648cc130a97d2c814c65aa8396044c251fd (patch) | |
tree | 95415853e28ee83e0342cc55944f3bc16d746f4f /helpers | |
parent | 6f13430d4a3b0d8b196f13958fbfb6478be1f3aa (diff) | |
download | hugo-8adba648cc130a97d2c814c65aa8396044c251fd.tar.gz hugo-8adba648cc130a97d2c814c65aa8396044c251fd.zip |
all: Remove unused code
Using x/tools/cmd/deadcode
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/content.go | 21 | ||||
-rw-r--r-- | helpers/emoji.go | 6 | ||||
-rw-r--r-- | helpers/general.go | 13 |
3 files changed, 0 insertions, 40 deletions
diff --git a/helpers/content.go b/helpers/content.go index c0a6d8221..a3abb334d 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -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 -} diff --git a/helpers/emoji.go b/helpers/emoji.go index a1617c48d..c103a5479 100644 --- a/helpers/emoji.go +++ b/helpers/emoji.go @@ -30,12 +30,6 @@ var ( emojiMaxSize int ) -// Emoji returns the emoji given a key, e.g. ":smile:", nil if not found. -func Emoji(key string) []byte { - emojiInit.Do(initEmoji) - return emojis[key] -} - // Emojify "emojifies" the input source. // Note that the input byte slice will be modified if needed. // See http://www.emoji-cheat-sheet.com/ diff --git a/helpers/general.go b/helpers/general.go index 281414b2a..b16aec0b0 100644 --- a/helpers/general.go +++ b/helpers/general.go @@ -32,7 +32,6 @@ import ( "github.com/jdkato/prose/transform" bp "github.com/gohugoio/hugo/bufferpool" - "github.com/spf13/pflag" ) // FilePathSeparator as defined by os.Separator. @@ -317,18 +316,6 @@ func IsWhitespace(r rune) bool { return r == ' ' || r == '\t' || r == '\n' || r == '\r' } -// NormalizeHugoFlags facilitates transitions of Hugo command-line flags, -// e.g. --baseUrl to --baseURL, --uglyUrls to --uglyURLs -func NormalizeHugoFlags(f *pflag.FlagSet, name string) pflag.NormalizedName { - switch name { - case "baseUrl": - name = "baseURL" - case "uglyUrls": - name = "uglyURLs" - } - return pflag.NormalizedName(name) -} - // PrintFs prints the given filesystem to the given writer starting from the given path. // This is useful for debugging. func PrintFs(fs afero.Fs, path string, w io.Writer) { |