shithub: hugo

Download patch

ref: d418c2c2eacdc1dc6fffe839e0a90600867878ca
parent: b2fcbb1f9774aa1e929b8575c0e1ac366ab2fb73
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Jan 25 04:58:55 EST 2018

Remove and update deprecation status

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -242,9 +242,6 @@
 	cmd.Flags().BoolP("buildDrafts", "D", false, "include content marked as draft")
 	cmd.Flags().BoolP("buildFuture", "F", false, "include content with publishdate in the future")
 	cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
-	cmd.Flags().Bool("disable404", false, "do not render 404 page")
-	cmd.Flags().Bool("disableRSS", false, "do not build RSS files")
-	cmd.Flags().Bool("disableSitemap", false, "do not build Sitemap file")
 	cmd.Flags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
 	cmd.Flags().StringVarP(&contentDir, "contentDir", "c", "", "filesystem path to content directory")
 	cmd.Flags().StringVarP(&layoutDir, "layoutDir", "l", "", "filesystem path to layout directory")
@@ -491,9 +488,6 @@
 		"buildExpired",
 		"uglyURLs",
 		"canonifyURLs",
-		"disable404",
-		"disableRSS",
-		"disableSitemap",
 		"enableRobotsTXT",
 		"enableGitInfo",
 		"pluralizeListTitles",
@@ -504,19 +498,6 @@
 		"noChmod",
 		"templateMetrics",
 		"templateMetricsHints",
-	}
-
-	// Remove these in Hugo 0.33.
-	if cmd.Flags().Changed("disable404") {
-		helpers.Deprecated("command line", "--disable404", "Use --disableKinds=404", true)
-	}
-
-	if cmd.Flags().Changed("disableRSS") {
-		helpers.Deprecated("command line", "--disableRSS", "Use --disableKinds=RSS", true)
-	}
-
-	if cmd.Flags().Changed("disableSitemap") {
-		helpers.Deprecated("command line", "--disableSitemap", "Use --disableKinds=sitemap", true)
 	}
 
 	for _, key := range persFlagKeys {
--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -64,23 +64,6 @@
 
 	v.RegisterAlias("indexes", "taxonomies")
 
-	// Remove these in Hugo 0.33.
-	if v.IsSet("disable404") {
-		helpers.Deprecated("site config", "disable404", "Use disableKinds=[\"404\"]", true)
-	}
-
-	if v.IsSet("disableRSS") {
-		helpers.Deprecated("site config", "disableRSS", "Use disableKinds=[\"RSS\"]", true)
-	}
-
-	if v.IsSet("disableSitemap") {
-		helpers.Deprecated("site config", "disableSitemap", "Use disableKinds= [\"sitemap\"]", true)
-	}
-
-	if v.IsSet("disableRobotsTXT") {
-		helpers.Deprecated("site config", "disableRobotsTXT", "Use disableKinds= [\"robotsTXT\"]", true)
-	}
-
 	if err := loadDefaultSettingsFor(v); err != nil {
 		return v, err
 	}
@@ -183,10 +166,6 @@
 	v.SetDefault("cleanDestinationDir", false)
 	v.SetDefault("watch", false)
 	v.SetDefault("metaDataFormat", "toml")
-	v.SetDefault("disable404", false)
-	v.SetDefault("disableRSS", false)
-	v.SetDefault("disableSitemap", false)
-	v.SetDefault("disableRobotsTXT", false)
 	v.SetDefault("contentDir", "content")
 	v.SetDefault("layoutDir", "layouts")
 	v.SetDefault("staticDir", "static")
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -331,10 +331,6 @@
 		return nil
 	}
 
-	if h.Cfg.GetBool("disableSitemap") {
-		return nil
-	}
-
 	sitemapEnabled := false
 	for _, s := range h.Sites {
 		if s.isEnabled(kindSitemap) {
--- a/hugolib/hugo_sites_build_test.go
+++ b/hugolib/hugo_sites_build_test.go
@@ -855,8 +855,6 @@
 
 var multiSiteTOMLConfigTemplate = `
 baseURL = "http://example.com/blog"
-disableSitemap = false
-disableRSS = false
 rssURI = "index.xml"
 
 paginate = 1
@@ -915,8 +913,6 @@
 
 var multiSiteYAMLConfigTemplate = `
 baseURL: "http://example.com/blog"
-disableSitemap: false
-disableRSS: false
 rssURI: "index.xml"
 
 disablePathToLower: true
@@ -976,8 +972,6 @@
 var multiSiteJSONConfigTemplate = `
 {
   "baseURL": "http://example.com/blog",
-  "disableSitemap": false,
-  "disableRSS": false,
   "rssURI": "index.xml",
   "paginate": 1,
   "disablePathToLower": true,
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -881,12 +881,6 @@
 	})
 }
 
-func (p *Page) Extension() string {
-	// Remove in Hugo 0.22.
-	helpers.Deprecated("Page", "Extension", "See OutputFormats with its MediaType", true)
-	return p.extension
-}
-
 // HasShortcode return whether the page has a shortcode with the given name.
 // This method is mainly motivated with the Hugo Docs site's need for a list
 // of pages with the `todo` shortcode in it.
@@ -1847,12 +1841,6 @@
 	c := *p
 	c.pageInit = &pageInit{}
 	return &c
-}
-
-func (p *Page) Now() time.Time {
-	// Delete in Hugo 0.22
-	helpers.Deprecated("Page", "Now", "Use now (the template func)", true)
-	return time.Now()
 }
 
 func (p *Page) Hugo() *HugoInfo {
--- a/hugolib/page_paths.go
+++ b/hugolib/page_paths.go
@@ -302,9 +302,3 @@
 
 	return tp
 }
-
-func (p *Page) TargetPath() (outfile string) {
-	// Delete in Hugo 0.22
-	helpers.Deprecated("Page", "TargetPath", "This method does not make sanse any more.", true)
-	return ""
-}
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -1483,7 +1483,6 @@
 		{func(n *Page) bool { return !n.IsPage() }},
 		{func(n *Page) bool { return n.Scratch() != nil }},
 		{func(n *Page) bool { return n.Hugo() != nil }},
-		{func(n *Page) bool { return n.Now().Unix() == time.Now().Unix() }},
 	} {
 
 		n := s.newHomePage()
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -371,11 +371,6 @@
 	sectionPagesMenu               string
 }
 
-func (s *SiteInfo) Files() []source.File {
-	helpers.Deprecated(".Site", "Files", "", true)
-	return nil
-}
-
 func (s *SiteInfo) String() string {
 	return fmt.Sprintf("Site(%q)", s.Title)
 }
--- a/hugolib/site_output.go
+++ b/hugolib/site_output.go
@@ -81,8 +81,8 @@
 			if rssBase == "" || rssBase == "index.xml" {
 				rssBase = rssOut.BaseName
 			} else {
-				// Remove in Hugo 0.22.
-				helpers.Deprecated("Site config", "rssURI", "Set baseName in outputFormats.RSS", false)
+				// Remove in Hugo 0.36.
+				helpers.Deprecated("Site config", "rssURI", "Set baseName in outputFormats.RSS", true)
 				// RSS has now a well defined media type, so strip any suffix provided
 				rssBase = strings.TrimSuffix(rssBase, path.Ext(rssBase))
 			}
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -250,10 +250,6 @@
 		return nil
 	}
 
-	if s.Cfg.GetBool("disableRSS") {
-		return nil
-	}
-
 	p.Kind = kindRSS
 
 	limit := s.Cfg.GetInt("rssLimit")
@@ -283,10 +279,6 @@
 		return nil
 	}
 
-	if s.Cfg.GetBool("disable404") {
-		return nil
-	}
-
 	p := s.newNodePage(kind404)
 
 	p.title = "404 Page not found"
@@ -318,10 +310,6 @@
 
 func (s *Site) renderSitemap() error {
 	if !s.isEnabled(kindSitemap) {
-		return nil
-	}
-
-	if s.Cfg.GetBool("disableSitemap") {
 		return nil
 	}
 
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -313,8 +313,6 @@
 
 	cfg.Set("verbose", true)
 	cfg.Set("baseURL", "http://auth/bub")
-	cfg.Set("disableSitemap", false)
-	cfg.Set("disableRSS", false)
 	cfg.Set("rssURI", "index.xml")
 	cfg.Set("blackfriday",
 		map[string]interface{}{