Fix: Reset the state variables at the end

Also update the casing of publishdate and expirydate to publishDate
and expiryDate to match with the documentation on
https://gohugo.io/content-management/front-matter/#front-matter-variables. The
case of the front matter variables does not matter, but still.. just
for consistency.
master
Kaushal Modi 9 years ago
parent 4cd62c330a
commit feba2055e5
  1. 4
      example-site/content/singles/post-draft.md
  2. 4
      example-site/content/singles/post-toml.md
  3. 5
      example-site/content/singles/post-yaml.md
  4. 10
      ox-hugo.el

@ -1,11 +1,11 @@
+++
title = "Single Post, but draft"
date = 2017-07-20
publishDate = "2017-07-22"
expiryDate = "2017-07-23"
tags = ["single", "toml"]
categories = ["cat1", "cat2"]
draft = true
publishdate = 2017-07-22
expirydate = 2017-07-23
[menu.foo]
parent = "main"
weight = 10

@ -1,10 +1,10 @@
+++
title = "Single Post with TOML front matter"
date = 2017-07-20
publishDate = "2017-07-22"
expiryDate = "2017-07-23"
tags = ["single", "toml"]
categories = ["cat1", "cat2"]
publishdate = 2017-07-22
expirydate = 2017-07-23
[menu.foo]
parent = "main"
weight = 10

@ -1,11 +1,10 @@
---
title : "Single Post with YAML front matter"
date : 2017-07-20
publishDate : "2017-07-22"
expiryDate : "2017-07-23"
tags : ["single", "yaml"]
categories : ["cat1", "cat2"]
draft : true
publishdate : 2017-07-22
expirydate : 2017-07-23
menu :
foo:
parent : "main"

@ -503,9 +503,9 @@ INFO is a plist used as a communication channel."
(title . ,title)
(description . ,(org-export-data (plist-get info :hugo-description) info))
(date . ,date)
(publishdate . ,(org-export-data (plist-get info :hugo-publishdate) info))
(publishDate . ,(org-export-data (plist-get info :hugo-publishdate) info))
(expiryDate . ,(org-export-data (plist-get info :hugo-expirydate) info))
(aliases . ,(org-export-data (plist-get info :hugo-aliases) info))
(expirydate . ,(org-export-data (plist-get info :hugo-expirydate) info))
(isCJKLanguage . ,(org-export-data (plist-get info :hugo-iscjklanguage) info))
(keywords . ,(org-export-data (plist-get info :keywords) info))
(layout . ,(org-export-data (plist-get info :hugo-layout) info))
@ -805,7 +805,11 @@ file."
(setq org-hugo--draft-state draft)
(setq org-hugo--tags-list tags)
(org-hugo-export-to-md nil :subtreep))))))
(user-error "It is mandatory to have a subtree with EXPORT_FILE_NAME property")))))))
(user-error "It is mandatory to have a subtree with EXPORT_FILE_NAME property")))
;; Reset the state variables again at the end.
(setq org-hugo--draft-state nil)
(setq org-hugo--tags-list nil)))))
;;;###autoload
(defun org-hugo-publish-to-md (plist filename pub-dir)

Loading…
Cancel
Save