diff options
author | Jonathan Anderson <jonathan.anderson@ieee.org> | 2015-01-23 21:56:29 -0330 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-01-24 10:46:52 +0100 |
commit | bd1b019f8512f5c93d42d4b65785965b7b084d0b (patch) | |
tree | 888cfd3fdbe02a7636c2275f6d7669948847b7dc /create | |
parent | b345ca26cbf486d0406f2d14e16d10bb7d64b516 (diff) |
Handle empty front matter in archetype.
If an archetype has deliberately empty front matter (e.g., to suppress
generation of the 'draft' field or to force a particular front matter type
instead of the default TOML), we should handle it gracefully rather than
panic ("assignment to entry in nil map").
Diffstat (limited to 'create')
-rw-r--r-- | create/content.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/create/content.go b/create/content.go index c3c1747a2..98b3652a4 100644 --- a/create/content.go +++ b/create/content.go @@ -81,6 +81,10 @@ func NewContent(kind, name string) (err error) { return false } + if newmetadata == nil { + newmetadata = make(map[string]interface{}) + } + if !caseimatch(newmetadata, "date") { newmetadata["date"] = time.Now() } |