shithub: hugo

Download patch

ref: ae5a45be6f0ee4d5c52b38fd28b22b55d9cd7b2d
parent: 4d912e2aad39bfe8d76672cf53b01317792e02c5
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Jan 25 12:08:18 EST 2018

hugolib: Remove unused code

--- a/hugolib/fileInfo.go
+++ b/hugolib/fileInfo.go
@@ -103,7 +103,3 @@
 
 	return ""
 }
-
-func (b bundleDirType) isBundle() bool {
-	return b > bundleNot
-}
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -478,12 +478,6 @@
 	return nil
 }
 
-func (h *HugoSites) removePageByPathPrefix(path string) {
-	for _, s := range h.Sites {
-		s.removePageByPathPrefix(path)
-	}
-}
-
 func (h *HugoSites) removePageByPath(path string) {
 	for _, s := range h.Sites {
 		s.removePageByPath(path)
--- a/hugolib/menu.go
+++ b/hugolib/menu.go
@@ -46,13 +46,6 @@
 // PageMenus is a dictionary of menus defined in the Pages.
 type PageMenus map[string]*MenuEntry
 
-// addChild adds a new child to this menu entry.
-// The default sort order will then be applied.
-func (m *MenuEntry) addChild(child *MenuEntry) {
-	m.Children = append(m.Children, child)
-	m.Children.Sort()
-}
-
 // HasChildren returns whether this menu item has any children.
 func (m *MenuEntry) HasChildren() bool {
 	return m.Children != nil
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -1988,10 +1988,6 @@
 	return p.Site.LanguagePrefix
 }
 
-func (p *Page) addLangPathPrefix(outfile string) string {
-	return p.addLangPathPrefixIfFlagSet(outfile, p.shouldAddLanguagePrefix())
-}
-
 func (p *Page) addLangPathPrefixIfFlagSet(outfile string, should bool) string {
 	if helpers.IsAbsURL(outfile) {
 		return outfile
--- a/hugolib/page_bundler_capture.go
+++ b/hugolib/page_bundler_capture.go
@@ -510,9 +510,6 @@
 	return newFileInfo(c.sourceSpec, c.baseDir, filename, fi, tp)
 }
 
-type singlesHandler func(fis ...*fileInfo)
-type bundlesHandler func(b *bundleDirs)
-
 type fileInfoName struct {
 	os.FileInfo
 	filename string
--- a/hugolib/page_bundler_handlers.go
+++ b/hugolib/page_bundler_handlers.go
@@ -182,15 +182,11 @@
 		resource resource.Resource
 	}
 
-	contentHandlerChain func(h contentHandler) contentHandler
-	contentHandler      func(ctx *handlerContext) handlerResult
+	contentHandler func(ctx *handlerContext) handlerResult
 )
 
 var (
-	notHandled        handlerResult
-	noOpContenHandler = func(ctx *handlerContext) handlerResult {
-		return handlerResult{handled: true}
-	}
+	notHandled handlerResult
 )
 
 func (c *contentHandlers) parsePage(h contentHandler) contentHandler {
--- a/hugolib/page_collections.go
+++ b/hugolib/page_collections.go
@@ -170,18 +170,6 @@
 	c.rawAllPages = append(c.rawAllPages, page)
 }
 
-// When we get a REMOVE event we're not always getting all the individual files,
-// so we need to remove all below a given path.
-func (c *PageCollections) removePageByPathPrefix(path string) {
-	for {
-		i := c.rawAllPages.findFirstPagePosByFilePathPrefix(path)
-		if i == -1 {
-			break
-		}
-		c.rawAllPages = append(c.rawAllPages[:i], c.rawAllPages[i+1:]...)
-	}
-}
-
 func (c *PageCollections) removePageByPath(path string) {
 	if i := c.rawAllPages.findPagePosByFilePath(path); i >= 0 {
 		c.clearResourceCacheForPage(c.rawAllPages[i])
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -398,7 +398,6 @@
 	language        *helpers.Language
 	s               *Site
 	pageCollections *PageCollections
-	baseURL         string
 }
 
 // TODO(bep) get rid of this
@@ -1785,63 +1784,6 @@
 	path = filepath.Join(s.absPublishDir(), path)
 
 	return helpers.WriteToDisk(path, r, s.Fs.Destination)
-}
-
-func (s *Site) draftStats() string {
-	var msg string
-
-	switch s.draftCount {
-	case 0:
-		return "0 draft content"
-	case 1:
-		msg = "1 draft rendered"
-	default:
-		msg = fmt.Sprintf("%d drafts rendered", s.draftCount)
-	}
-
-	if s.Cfg.GetBool("buildDrafts") {
-		return fmt.Sprintf("%d of ", s.draftCount) + msg
-	}
-
-	return "0 of " + msg
-}
-
-func (s *Site) futureStats() string {
-	var msg string
-
-	switch s.futureCount {
-	case 0:
-		return "0 future content"
-	case 1:
-		msg = "1 future rendered"
-	default:
-		msg = fmt.Sprintf("%d futures rendered", s.futureCount)
-	}
-
-	if s.Cfg.GetBool("buildFuture") {
-		return fmt.Sprintf("%d of ", s.futureCount) + msg
-	}
-
-	return "0 of " + msg
-}
-
-func (s *Site) expiredStats() string {
-	var msg string
-
-	switch s.expiredCount {
-	case 0:
-		return "0 expired content"
-	case 1:
-		msg = "1 expired rendered"
-	default:
-		msg = fmt.Sprintf("%d expired rendered", s.expiredCount)
-	}
-
-	if s.Cfg.GetBool("buildExpired") {
-		return fmt.Sprintf("%d of ", s.expiredCount) + msg
-	}
-
-	return "0 of " + msg
 }
 
 func getGoMaxProcs() int {
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -31,11 +31,6 @@
 )
 
 const (
-	pageSimpleTitle = `---
-title: simple template
----
-content`
-
 	templateMissingFunc = "{{ .Title | funcdoesnotexists }}"
 	templateWithURLAbs  = "<a href=\"/foobar.jpg\">Going</a>"
 )