mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
@@ -396,24 +396,6 @@ func WordCount(s string) map[string]int {
|
||||
return m
|
||||
}
|
||||
|
||||
// RemoveSummaryDivider removes summary-divider <!--more--> from content.
|
||||
// TODO(bep) ml remove
|
||||
func RemoveSummaryDivider(content []byte) []byte {
|
||||
b := bytes.Replace(content, summaryDividerAndNewLines, []byte(""), 1)
|
||||
if len(b) != len(content) {
|
||||
return b
|
||||
}
|
||||
return bytes.Replace(content, SummaryDivider, []byte(""), 1)
|
||||
}
|
||||
|
||||
func removeInternalSummaryDivider(content []byte) []byte {
|
||||
b := bytes.Replace(content, summaryDividerAndNewLines, []byte(""), 1)
|
||||
if len(b) != len(content) {
|
||||
return b
|
||||
}
|
||||
return bytes.Replace(content, SummaryDivider, []byte(""), 1)
|
||||
}
|
||||
|
||||
// TruncateWordsByRune truncates words by runes.
|
||||
func TruncateWordsByRune(words []string, max int) (string, bool) {
|
||||
count := 0
|
||||
|
@@ -409,13 +409,3 @@ func TestWordCount(t *testing.T) {
|
||||
t.Errorf("Actual Map (%v) does not equal expected (%v)", actualMap, expectedMap)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveSummaryDivider(t *testing.T) {
|
||||
content := []byte("This is before. <!--more-->This is after.")
|
||||
actualRemovedContent := RemoveSummaryDivider(content)
|
||||
expectedRemovedContent := []byte("This is before. This is after.")
|
||||
|
||||
if !bytes.Equal(actualRemovedContent, expectedRemovedContent) {
|
||||
t.Errorf("Actual removed content (%s) did not equal expected removed content (%s)", actualRemovedContent, expectedRemovedContent)
|
||||
}
|
||||
}
|
||||
|
@@ -186,7 +186,6 @@ func getLanguagePrefix() string {
|
||||
}
|
||||
|
||||
// IsAbsURL determines whether the given path points to an absolute URL.
|
||||
// TODO(bep) ml tests
|
||||
func IsAbsURL(path string) bool {
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user