mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-10 09:57:38 +00:00
hugolib: Remove unused code
This commit is contained in:
parent
4d912e2aad
commit
ae5a45be6f
9 changed files with 2 additions and 105 deletions
|
@ -103,7 +103,3 @@ func (b bundleDirType) String() string {
|
|||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (b bundleDirType) isBundle() bool {
|
||||
return b > bundleNot
|
||||
}
|
||||
|
|
|
@ -478,12 +478,6 @@ func (h *HugoSites) createMissingPages() error {
|
|||
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)
|
||||
|
|
|
@ -46,13 +46,6 @@ type Menus map[string]*Menu
|
|||
// 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
|
||||
|
|
|
@ -1988,10 +1988,6 @@ func (p *Page) LanguagePrefix() string {
|
|||
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
|
||||
|
|
|
@ -510,9 +510,6 @@ func (c *capturer) newFileInfo(filename string, fi os.FileInfo, tp bundleDirType
|
|||
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
|
||||
|
|
|
@ -182,15 +182,11 @@ type (
|
|||
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 {
|
||||
|
|
|
@ -170,18 +170,6 @@ func (c *PageCollections) addPage(page *Page) {
|
|||
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])
|
||||
|
|
|
@ -398,7 +398,6 @@ type siteBuilderCfg struct {
|
|||
language *helpers.Language
|
||||
s *Site
|
||||
pageCollections *PageCollections
|
||||
baseURL string
|
||||
}
|
||||
|
||||
// TODO(bep) get rid of this
|
||||
|
@ -1787,63 +1786,6 @@ func (s *Site) publish(statCounter *uint64, path string, r io.Reader) (err error
|
|||
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 {
|
||||
if gmp := os.Getenv("GOMAXPROCS"); gmp != "" {
|
||||
if p, err := strconv.Atoi(gmp); err != nil {
|
||||
|
|
|
@ -31,11 +31,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
pageSimpleTitle = `---
|
||||
title: simple template
|
||||
---
|
||||
content`
|
||||
|
||||
templateMissingFunc = "{{ .Title | funcdoesnotexists }}"
|
||||
templateWithURLAbs = "<a href=\"/foobar.jpg\">Going</a>"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue