URI: 
       Revise the deprecation strategy - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit f1ed89fec41302ef37ad86348063a7a9be4ef587
   DIR parent 0a0db9cd259bf14bf38f1c954e39ecaa70f26923
  HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Wed, 23 Nov 2016 17:26:13 +0100
       
       Revise the deprecation strategy
       
       Git users and theme authors two Hugo releases to fix:
       
       1. With a visible warning
       2. Then with an ERROR that exits with -1
       
       Fixes #2726
       
       Diffstat:
         M helpers/general.go                  |      25 +++++++++++++++++++------
         M hugolib/page.go                     |       8 ++++----
         M hugolib/page_test.go                |       1 +
         M hugolib/site.go                     |       2 +-
       
       4 files changed, 25 insertions(+), 11 deletions(-)
       ---
   DIR diff --git a/helpers/general.go b/helpers/general.go
       @@ -250,19 +250,32 @@ func NewDistinctFeedbackLogger() *DistinctLogger {
                return &DistinctLogger{m: make(map[string]bool), logger: &jww.FEEDBACK}
        }
        
       -// DistinctErrorLog cann be used to avoid spamming the logs with errors.
       -var DistinctErrorLog = NewDistinctErrorLogger()
       +var (
       +        // DistinctErrorLog can be used to avoid spamming the logs with errors.
       +        DistinctErrorLog = NewDistinctErrorLogger()
       +
       +        // DistinctFeedbackLog can be used to avoid spamming the logs with info messages.
       +        DistinctFeedbackLog = NewDistinctFeedbackLogger()
       +)
        
        // InitLoggers sets up the global distinct loggers.
        func InitLoggers() {
                DistinctErrorLog = NewDistinctErrorLogger()
        }
        
       -// Deprecated logs ERROR logs about a deprecation, but only once for a given set of arguments' values.
       -func Deprecated(object, item, alternative string) {
       -        //        deprecatedLogger.Printf("%s's %s is deprecated and will be removed in Hugo %s. Use %s instead.", object, item, NextHugoReleaseVersion(), alternative)
       -        DistinctErrorLog.Printf("%s's %s is deprecated and will be removed in a future release. Use %s instead.", object, item, alternative)
       +// Deprecated informs about a deprecation, but only once for a given set of arguments' values.
       +// If the err flag is enabled, it logs as an ERROR (will exit with -1) and the text will
       +// point at the next Hugo release.
       +// The idea is two remove an item in two Hugo releases to give users and theme authors
       +// plenty of time to fix their templates.
       +func Deprecated(object, item, alternative string, err bool) {
       +        if err {
       +                DistinctErrorLog.Printf("%s's %s is deprecated and will be removed in Hugo %s. Use %s instead.", object, item, NextHugoReleaseVersion(), alternative)
        
       +        } else {
       +                // Make sure the users see this while avoiding build breakage. This will not lead to an os.Exit(-1)
       +                DistinctFeedbackLog.Printf("WARNING: %s's %s is deprecated and will be removed in a future release. Use %s instead.", object, item, alternative)
       +        }
        }
        
        // SliceToLower goes through the source slice and lowers all values.
   DIR diff --git a/hugolib/page.go b/hugolib/page.go
       @@ -242,18 +242,18 @@ type PageMeta struct {
        }
        
        func (*PageMeta) WordCount() int {
       -        helpers.Deprecated("PageMeta", "WordCount", ".WordCount (on Page)")
       +        helpers.Deprecated("PageMeta", "WordCount", ".WordCount (on Page)", true)
                return 0
        }
        
        func (*PageMeta) FuzzyWordCount() int {
       -        helpers.Deprecated("PageMeta", "FuzzyWordCount", ".FuzzyWordCount (on Page)")
       +        helpers.Deprecated("PageMeta", "FuzzyWordCount", ".FuzzyWordCount (on Page)", true)
                return 0
        
        }
        
        func (*PageMeta) ReadingTime() int {
       -        helpers.Deprecated("PageMeta", "ReadingTime", ".ReadingTime (on Page)")
       +        helpers.Deprecated("PageMeta", "ReadingTime", ".ReadingTime (on Page)", true)
                return 0
        }
        
       @@ -1565,7 +1565,7 @@ func (p *Page) Hugo() *HugoInfo {
        
        func (p *Page) RSSlink() template.HTML {
                // TODO(bep) we cannot have two of these
       -        helpers.Deprecated(".Page", "RSSlink", "RSSLink")
       +        helpers.Deprecated(".Page", "RSSlink", "RSSLink", false)
                return p.RSSLink
        }
        
   DIR diff --git a/hugolib/page_test.go b/hugolib/page_test.go
       @@ -1270,6 +1270,7 @@ func TestIndexPageSimpleMethods(t *testing.T) {
                } {
        
                        n := &Page{pageInit: &pageInit{}, Kind: KindHome}
       +
                        n.RSSLink = "rssLink"
        
                        if !this.assertFunc(n) {
   DIR diff --git a/hugolib/site.go b/hugolib/site.go
       @@ -245,7 +245,7 @@ func (s *SiteInfo) Param(key interface{}) (interface{}, error) {
        
        // GetParam gets a site parameter value if found, nil if not.
        func (s *SiteInfo) GetParam(key string) interface{} {
       -        helpers.Deprecated("SiteInfo", ".GetParam", ".Param")
       +        helpers.Deprecated("SiteInfo", ".GetParam", ".Param", false)
                v := s.Params[strings.ToLower(key)]
        
                if v == nil {