From feba2055e578953ec2e11c73f90c97f9047b52fc Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Thu, 20 Jul 2017 14:22:21 -0400 Subject: [PATCH] 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. --- example-site/content/singles/post-draft.md | 4 ++-- example-site/content/singles/post-toml.md | 4 ++-- example-site/content/singles/post-yaml.md | 5 ++--- ox-hugo.el | 10 +++++++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/example-site/content/singles/post-draft.md b/example-site/content/singles/post-draft.md index e9db709..f6355a8 100644 --- a/example-site/content/singles/post-draft.md +++ b/example-site/content/singles/post-draft.md @@ -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 diff --git a/example-site/content/singles/post-toml.md b/example-site/content/singles/post-toml.md index 8bd689e..bfee03f 100644 --- a/example-site/content/singles/post-toml.md +++ b/example-site/content/singles/post-toml.md @@ -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 diff --git a/example-site/content/singles/post-yaml.md b/example-site/content/singles/post-yaml.md index e634ee1..3d4dbb5 100644 --- a/example-site/content/singles/post-yaml.md +++ b/example-site/content/singles/post-yaml.md @@ -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" diff --git a/ox-hugo.el b/ox-hugo.el index 0f495ad..82ab1ab 100644 --- a/ox-hugo.el +++ b/ox-hugo.el @@ -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)