summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-25 20:04:49 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-25 20:14:20 +0100
commit33d733300a4f0b765234706e51bb7e077fdc2471 (patch)
treea89cfea59a0d115c9d2368a7a68dde96353cd3e0 /helpers
parente3451371bdb68015f89c8c0f7d8ea0a19fff8df5 (diff)
Deprecate mmark
Fixes #6486
Diffstat (limited to 'helpers')
-rw-r--r--helpers/content.go3
-rw-r--r--helpers/general.go24
2 files changed, 13 insertions, 14 deletions
diff --git a/helpers/content.go b/helpers/content.go
index 941475461..4dc4cd413 100644
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -198,6 +198,9 @@ func (c *ContentSpec) ResolveMarkup(in string) string {
case "html", "htm":
return "html"
default:
+ if in == "mmark" {
+ Deprecated("Markup type mmark", "See https://gohugo.io//content-management/formats/#list-of-content-formats", false)
+ }
if conv := c.Converters.Get(in); conv != nil {
return conv.Name()
}
diff --git a/helpers/general.go b/helpers/general.go
index 259bcf8f4..699ddeb53 100644
--- a/helpers/general.go
+++ b/helpers/general.go
@@ -252,8 +252,8 @@ type LogPrinter interface {
// DistinctLogger ignores duplicate log statements.
type DistinctLogger struct {
sync.RWMutex
- logger LogPrinter
- m map[string]bool
+ getLogger func() LogPrinter
+ m map[string]bool
}
func (l *DistinctLogger) Reset() {
@@ -289,7 +289,7 @@ func (l *DistinctLogger) print(logStatement string) {
l.Lock()
if !l.m[logStatement] {
- l.logger.Println(logStatement)
+ l.getLogger().Println(logStatement)
l.m[logStatement] = true
}
l.Unlock()
@@ -297,23 +297,23 @@ func (l *DistinctLogger) print(logStatement string) {
// NewDistinctErrorLogger creates a new DistinctLogger that logs ERRORs
func NewDistinctErrorLogger() *DistinctLogger {
- return &DistinctLogger{m: make(map[string]bool), logger: jww.ERROR}
+ return &DistinctLogger{m: make(map[string]bool), getLogger: func() LogPrinter { return jww.ERROR }}
}
// NewDistinctLogger creates a new DistinctLogger that logs to the provided logger.
func NewDistinctLogger(logger LogPrinter) *DistinctLogger {
- return &DistinctLogger{m: make(map[string]bool), logger: logger}
+ return &DistinctLogger{m: make(map[string]bool), getLogger: func() LogPrinter { return logger }}
}
// NewDistinctWarnLogger creates a new DistinctLogger that logs WARNs
func NewDistinctWarnLogger() *DistinctLogger {
- return &DistinctLogger{m: make(map[string]bool), logger: jww.WARN}
+ return &DistinctLogger{m: make(map[string]bool), getLogger: func() LogPrinter { return jww.WARN }}
}
// NewDistinctFeedbackLogger creates a new DistinctLogger that can be used
// to give feedback to the user while not spamming with duplicates.
func NewDistinctFeedbackLogger() *DistinctLogger {
- return &DistinctLogger{m: make(map[string]bool), logger: jww.FEEDBACK}
+ return &DistinctLogger{m: make(map[string]bool), getLogger: func() LogPrinter { return jww.FEEDBACK }}
}
var (
@@ -339,16 +339,12 @@ func InitLoggers() {
// 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 !strings.HasSuffix(alternative, ".") {
- alternative += "."
- }
-
+func Deprecated(item, alternative string, err bool) {
if err {
- DistinctErrorLog.Printf("%s's %s is deprecated and will be removed in Hugo %s. %s", object, item, hugo.CurrentVersion.Next().ReleaseVersion(), alternative)
+ DistinctErrorLog.Printf("%s is deprecated and will be removed in Hugo %s. %s", item, hugo.CurrentVersion.Next().ReleaseVersion(), alternative)
} else {
- DistinctWarnLog.Printf("%s's %s is deprecated and will be removed in a future release. %s", object, item, alternative)
+ DistinctWarnLog.Printf("%s is deprecated and will be removed in a future release. %s", item, alternative)
}
}